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) { function pathExists(path) {
try { try {
const entries = file.readPathSync(path); // 尝试读取路径内容 return file.isFolder(path);
return entries !== undefined && entries.length >= 0; } catch {
} catch (error) { return false;
return false; // 如果读取失败,返回 false
} }
} }