-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(bot): we now delete old file when overwriting a bot (#11371)
* fix(bot): fix unmounting bot before writing files when overwriting * fix(bot): we now delete old file when overwriting a bot
- Loading branch information
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { existsSync } from 'fs' | ||
import { join } from 'path' | ||
|
||
/** | ||
* Finds files that were deleted in a given folder. | ||
* @param files A list of files (relative path) | ||
* @param folder A folder to walk through and test if files were deleted from it | ||
* @returns A list of deleted files (relative path) | ||
*/ | ||
export const findDeletedFiles = async (files: string[], folder: string): Promise<string[]> => { | ||
const deletedFiles: string[] = [] | ||
for (const f of files) { | ||
const path = join(folder, f) | ||
if (!existsSync(path)) { | ||
deletedFiles.push(f) | ||
} | ||
} | ||
return deletedFiles | ||
} |