Skip to content

Commit

Permalink
Catch the errors by deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed Sep 8, 2024
1 parent b3048ca commit adb74cc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ And use in `package.json` `scripts`:
### **WORK IN PROGRESS**
-->
## Changelog
### 0.1.1 (2024-09-07)
### **WORK IN PROGRESS**
* (bluefox) Catch the errors by deletion

### 0.1.1 (2024-09-04)
* (bluefox) Export `collectFiles` method

### 0.1.0 (2024-09-04)
Expand Down
12 changes: 10 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,17 @@ export function deleteFoldersRecursive(
const stat = statSync(curPath);
if (stat.isDirectory()) {
deleteFoldersRecursive(curPath);
rmdirSync(curPath);
try {
rmdirSync(curPath);
} catch (e) {
console.warn(`Cannot delete "${curPath}: ${e}`);
}
} else {
unlinkSync(curPath);
try {
unlinkSync(curPath);
} catch (e) {
console.warn(`Cannot delete "${curPath}: ${e}`);
}
}
}
}
Expand Down

0 comments on commit adb74cc

Please sign in to comment.