File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 2020use function array_values ;
2121use function copy ;
2222use function error_get_last ;
23+ use function explode ;
2324use function function_exists ;
2425use function implode ;
2526use function is_dir ;
@@ -171,9 +172,15 @@ public static function realpath(string $path): string
171172 return '' ;
172173 }
173174
174- // ~: is user home dir in *nix OS
175- if ($ parts [0 ] === '~ ' && false === OS ::isWindows ()) {
176- $ parts [0 ] = OS ::getUserHomeDir ();
175+ $ start = '' ;
176+ $ isUnix = DIRECTORY_SEPARATOR === '/ ' ;
177+ if ($ isUnix ) {
178+ // ~: is user home dir in *nix OS
179+ if ($ parts [0 ] === '~ ' ) {
180+ $ parts [0 ] = OS ::getUserHomeDir ();
181+ } else {
182+ $ start = '/ ' ;
183+ }
177184 }
178185
179186 $ absolutes = [];
@@ -189,7 +196,7 @@ public static function realpath(string $path): string
189196 }
190197 }
191198
192- return implode (DIRECTORY_SEPARATOR , $ absolutes );
199+ return $ start . implode (DIRECTORY_SEPARATOR , $ absolutes );
193200 }
194201
195202 /**********************************************************************************
You can’t perform that action at this time.
0 commit comments