@@ -70,7 +70,7 @@ public function path($type = 'storage')
70
70
} elseif ($ type == 'storage ' ) {
71
71
// storage: files/{user_slug}
72
72
// 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 ' ));
74
74
} else {
75
75
// absolute: /var/www/html/project/storage/app/files/{user_slug}
76
76
// absolute on windows: C:\project\storage\app\files\{user_slug}
@@ -83,11 +83,6 @@ public function translateToLfmPath($path)
83
83
return str_replace ($ this ->helper ->ds (), Lfm::DS , $ path );
84
84
}
85
85
86
- public function translateToOsPath ($ path )
87
- {
88
- return str_replace (Lfm::DS , $ this ->helper ->ds (), $ path );
89
- }
90
-
91
86
public function url ()
92
87
{
93
88
return $ this ->storage ->url ($ this ->path ('url ' ));
@@ -96,7 +91,7 @@ public function url()
96
91
public function folders ()
97
92
{
98
93
$ all_folders = array_map (function ($ directory_path ) {
99
- return $ this ->pretty ($ directory_path );
94
+ return $ this ->pretty ($ directory_path, true );
100
95
}, $ this ->storage ->directories ());
101
96
102
97
$ folders = array_filter ($ all_folders , function ($ directory ) {
@@ -115,11 +110,12 @@ public function files()
115
110
return $ this ->sortByColumn ($ files );
116
111
}
117
112
118
- public function pretty ($ item_path )
113
+ public function pretty ($ item_path, $ isDirectory = false )
119
114
{
120
115
return Container::getInstance ()->makeWith (LfmItem::class, [
121
116
'lfm ' => (clone $ this )->setName ($ this ->helper ->getNameFromPath ($ item_path )),
122
- 'helper ' => $ this ->helper
117
+ 'helper ' => $ this ->helper ,
118
+ 'isDirectory ' => $ isDirectory
123
119
]);
124
120
}
125
121
0 commit comments