-
-
Notifications
You must be signed in to change notification settings - Fork 49
Failed read the root directory on OS Windows 7 #14
Comments
It is the only cross-platform solution $origin_path = $path;
// wrap fs
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
stream_wrapper_register('win', 'Patchwork\Utf8\WinFsStreamWrapper');
$path = 'win://'.$path;
}
// scan directory
$folders = [];
/* @var $file \SplFileInfo */
foreach (new \DirectoryIterator($path) as $file) {
if (
!in_array($file->getFilename(), ['.', '..', '.Spotlight-V100', '.Trashes', 'pagefile.sys']) &&
$file->isDir() && $file->isReadable()
) {
$folders[$file->getFilename()] = [
'name' => $file->getFilename(),
'path' => $origin_path.$file->getFilename().DIRECTORY_SEPARATOR
];
}
}
ksort($folders);
// add link on parent folder
if (substr_count($origin_path, DIRECTORY_SEPARATOR) > 1) {
$pos = strrpos(substr($origin_path, 0, -1), DIRECTORY_SEPARATOR) + 1;
array_unshift($folders, [
'name' => '..',
'path' => substr($origin_path, 0, $pos)
]);
} Сhecked by:
|
I currently don't have a WIndows to test... |
I'll look for a solution, and if i find it i make a patch |
Thanks! |
I still didn't find a Windows machine to test the problem, but I want to let you know that I just added a new |
Thank you. I will be glad to take advantage |
Should be fixed by f1a9734 |
lstat() is called when reading directory
Unknown error occurs in the class com_exception when calling
The text was updated successfully, but these errors were encountered: