Refactor pathExists function to use isFolder (#2807)

修复bug
This commit is contained in:
吉吉喵
2026-01-28 22:20:33 +08:00
committed by GitHub
parent 402b32c234
commit e94b05860d

View File

@@ -8,10 +8,9 @@ function basename(filePath) {
// 检查路径是否存在
function pathExists(path) {
try {
const entries = file.readPathSync(path); // 尝试读取路径内容
return entries !== undefined && entries.length >= 0;
} catch (error) {
return false; // 如果读取失败,返回 false
return file.isFolder(path);
} catch {
return false;
}
}