Skip to content

Commit 0eda08d

Browse files
committed
fix: check for link first before checking for is_dir
1 parent e5069fa commit 0eda08d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/SPC/store/FileSystem.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -408,13 +408,13 @@ public static function removeDir(string $dir): bool
408408
continue;
409409
}
410410
$sub_file = self::convertPath($dir . '/' . $v);
411-
if (is_dir($sub_file)) {
412-
# 如果是 目录 且 递推 , 则递推添加下级文件
413-
if (!self::removeDir($sub_file)) {
411+
if (is_link($sub_file) || is_file($sub_file)) {
412+
if (!unlink($sub_file)) {
414413
return false;
415414
}
416-
} elseif (is_link($sub_file) || is_file($sub_file)) {
417-
if (!unlink($sub_file)) {
415+
} elseif (is_dir($sub_file)) {
416+
# 如果是 目录 且 递推 , 则递推添加下级文件
417+
if (!self::removeDir($sub_file)) {
418418
return false;
419419
}
420420
}

0 commit comments

Comments
 (0)