From: <var...@us...> - 2021-09-17 15:06:35
|
Revision: 10569 http://sourceforge.net/p/phpwiki/code/10569 Author: vargenau Date: 2021-09-17 15:06:32 +0000 (Fri, 17 Sep 2021) Log Message: ----------- slashifyPath only takes a string Modified Paths: -------------- trunk/lib/FileFinder.php Modified: trunk/lib/FileFinder.php =================================================================== --- trunk/lib/FileFinder.php 2021-09-17 14:23:54 UTC (rev 10568) +++ trunk/lib/FileFinder.php 2021-09-17 15:06:32 UTC (rev 10569) @@ -69,30 +69,22 @@ /** * Force using '/' as path separator. - * Accepts array of paths also. * - * @param string|array $path - * @return string|array + * @param string $path + * @return string */ public function slashifyPath($path) { - if (is_array($path)) { - $result = array(); - foreach ($path as $dir) { - $result[] = $this->slashifyPath($dir); - } - return $result; + if (isWindows()) { + $from = "\\"; + // PHP is stupid enough to use \\ instead of \ + if (substr($path, 0, 2) != '\\\\') + $path = str_replace('\\\\', '\\', $path); + else // UNC paths + $path = '\\\\' . str_replace('\\\\', '\\', substr($path, 2)); + return strtr($path, $from, '/'); } else { - if (isWindows()) { - $from = "\\"; - // PHP is stupid enough to use \\ instead of \ - if (substr($path, 0, 2) != '\\\\') - $path = str_replace('\\\\', '\\', $path); - else // UNC paths - $path = '\\\\' . str_replace('\\\\', '\\', substr($path, 2)); - return strtr($path, $from, '/'); - } else - return $path; + return $path; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |