From b38b1e87d381e41b1587511db41fb91a833499c9 Mon Sep 17 00:00:00 2001 From: LiamillionSS Date: Sat, 15 Feb 2025 00:26:15 +1100 Subject: [PATCH 1/2] bugfix/806 fix linux UUID folders not deleting --- src/main/helpers/fs.helpers.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/helpers/fs.helpers.ts b/src/main/helpers/fs.helpers.ts index 58f8f233..d119fff2 100644 --- a/src/main/helpers/fs.helpers.ts +++ b/src/main/helpers/fs.helpers.ts @@ -1,4 +1,4 @@ -import { CopyOptions, MoveOptions, RmOptions, copy, createReadStream, ensureDir, move, pathExists, pathExistsSync, realpath, rm, stat, symlink, unlink, unlinkSync } from "fs-extra"; +import { CopyOptions, MoveOptions, RmOptions, copy, createReadStream, ensureDir, move, pathExists, pathExistsSync, realpath, rm, stat, symlink, unlink, unlinkSync, rmSync } from "fs-extra"; import { access, mkdir, readdir, lstat, readlink } from "fs/promises"; import path from "path"; import { Observable, concatMap, from } from "rxjs"; @@ -63,7 +63,7 @@ export async function deleteFolder(folderPath: string, options?: RmOptions) { } } -export function deleteFolderSync(folderPath: string, options?: RmOptions) { +export async function deleteFolderSync(folderPath: string, options?: RmOptions) { if (!pathExistsSync(folderPath)) { return; } @@ -71,6 +71,7 @@ export function deleteFolderSync(folderPath: string, options?: RmOptions) { try { options = options || { recursive: true, force: true }; log.info("Deleting folder", `"${folderPath}"`, options); + rmSync(folderPath, options); } catch (error: any) { log.error("Could not delete folder", `"${folderPath}"`); throw CustomError.fromError(error, "generic.fs.delete-folder"); From df8c7f23762013b9ea855b548daa4bc11d0e175e Mon Sep 17 00:00:00 2001 From: LiamillionSS Date: Sat, 15 Feb 2025 00:26:15 +1100 Subject: [PATCH 2/2] bugfix/806 fix linux UUID folders not deleting, non async --- src/main/helpers/fs.helpers.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/helpers/fs.helpers.ts b/src/main/helpers/fs.helpers.ts index 58f8f233..a3df7860 100644 --- a/src/main/helpers/fs.helpers.ts +++ b/src/main/helpers/fs.helpers.ts @@ -1,4 +1,4 @@ -import { CopyOptions, MoveOptions, RmOptions, copy, createReadStream, ensureDir, move, pathExists, pathExistsSync, realpath, rm, stat, symlink, unlink, unlinkSync } from "fs-extra"; +import { CopyOptions, MoveOptions, RmOptions, copy, createReadStream, ensureDir, move, pathExists, pathExistsSync, realpath, rm, stat, symlink, unlink, unlinkSync, rmSync } from "fs-extra"; import { access, mkdir, readdir, lstat, readlink } from "fs/promises"; import path from "path"; import { Observable, concatMap, from } from "rxjs"; @@ -71,6 +71,7 @@ export function deleteFolderSync(folderPath: string, options?: RmOptions) { try { options = options || { recursive: true, force: true }; log.info("Deleting folder", `"${folderPath}"`, options); + rmSync(folderPath, options); } catch (error: any) { log.error("Could not delete folder", `"${folderPath}"`); throw CustomError.fromError(error, "generic.fs.delete-folder");