@@ -70,7 +70,7 @@ public function path($type = 'storage')
7070 } elseif ($ type == 'storage ' ) {
7171 // storage: files/{user_slug}
7272 // storage on windows: files\{user_slug}
73- return $ this ->translateToOsPath ( $ this ->path ('url ' ));
73+ return str_replace (Lfm:: DS , $ this ->helper -> ds (), $ this ->path ('url ' ));
7474 } else {
7575 // absolute: /var/www/html/project/storage/app/files/{user_slug}
7676 // absolute on windows: C:\project\storage\app\files\{user_slug}
@@ -83,11 +83,6 @@ public function translateToLfmPath($path)
8383 return str_replace ($ this ->helper ->ds (), Lfm::DS , $ path );
8484 }
8585
86- public function translateToOsPath ($ path )
87- {
88- return str_replace (Lfm::DS , $ this ->helper ->ds (), $ path );
89- }
90-
9186 public function url ()
9287 {
9388 return $ this ->storage ->url ($ this ->path ('url ' ));
@@ -96,7 +91,7 @@ public function url()
9691 public function folders ()
9792 {
9893 $ all_folders = array_map (function ($ directory_path ) {
99- return $ this ->pretty ($ directory_path );
94+ return $ this ->pretty ($ directory_path, true );
10095 }, $ this ->storage ->directories ());
10196
10297 $ folders = array_filter ($ all_folders , function ($ directory ) {
@@ -115,11 +110,12 @@ public function files()
115110 return $ this ->sortByColumn ($ files );
116111 }
117112
118- public function pretty ($ item_path )
113+ public function pretty ($ item_path, $ isDirectory = false )
119114 {
120115 return Container::getInstance ()->makeWith (LfmItem::class, [
121116 'lfm ' => (clone $ this )->setName ($ this ->helper ->getNameFromPath ($ item_path )),
122- 'helper ' => $ this ->helper
117+ 'helper ' => $ this ->helper ,
118+ 'isDirectory ' => $ isDirectory
123119 ]);
124120 }
125121
0 commit comments