Merge pull request #162 from zhamao-robot/windows-support-relative-path

FileSystem.php isRelativePath() 对 Windows 的兼容性
This commit is contained in:
Jerry Ma
2022-08-27 20:34:02 +08:00
committed by GitHub

View File

@@ -70,6 +70,10 @@ class FileSystem
*/
public static function isRelativePath(string $path): bool
{
// 适配 Windows 的多盘符目录形式
if (DIRECTORY_SEPARATOR === '\\') {
return strlen($path) > 2 && ctype_alpha($path[0]) && $path[1] === ':';
}
return strlen($path) > 0 && $path[0] !== '/';
}