mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-01 04:40:38 +08:00
修复清空文件夹报错
This commit is contained in:
+2
-2
@@ -309,7 +309,7 @@ export async function emptyDir(path: string) {
|
||||
return;
|
||||
}
|
||||
const files = fs.readdirSync(path);
|
||||
files.forEach(async (file) => {
|
||||
for (const file of files) {
|
||||
const filePath = `${path}/${file}`;
|
||||
const stats = fs.statSync(filePath);
|
||||
if (stats.isDirectory()) {
|
||||
@@ -317,7 +317,7 @@ export async function emptyDir(path: string) {
|
||||
} else {
|
||||
fs.unlinkSync(filePath);
|
||||
}
|
||||
});
|
||||
}
|
||||
fs.rmdirSync(path);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user