From 275191410d4844219be4b681529311567b2552d4 Mon Sep 17 00:00:00 2001 From: The1111mp Date: Tue, 9 Apr 2024 11:24:34 +0800 Subject: [PATCH] refactor: there is no need to call remove before copying the file Signed-off-by: The1111mp --- src/main/utils/migration.ts | 16 ++-------------- src/renderer/src/components/ui/tour.tsx | 0 2 files changed, 2 insertions(+), 14 deletions(-) delete mode 100644 src/renderer/src/components/ui/tour.tsx diff --git a/src/main/utils/migration.ts b/src/main/utils/migration.ts index a6bd22a..6a362af 100644 --- a/src/main/utils/migration.ts +++ b/src/main/utils/migration.ts @@ -88,8 +88,6 @@ async function updateToSchemaVersionLast(version: number) { if (platform !== "win32") { const targetFile = join(BIN_DIR, "nvmd"); - await remove(targetFile); - const sourceFile = app.isPackaged ? join(process.resourcesPath, "assets", "sources", "nvmd") : join(__dirname, "../../..", "assets", "sources", "nvmd"); @@ -100,27 +98,17 @@ async function updateToSchemaVersionLast(version: number) { } // Windows - const targetFile = join(BIN_DIR, "nvmd.exe"); - - await remove(targetFile); - const sourceFile = app.isPackaged ? join(process.resourcesPath, "assets", "sources", `${arch}.exe`) : join(__dirname, "../../..", "assets", "sources", `${arch}.exe`); - await copy(sourceFile, targetFile).catch((_err) => {}); + await copy(sourceFile, join(BIN_DIR, "nvmd.exe")).catch((_err) => {}); async function updateFile(fileName: string) { - const filePath = join(BIN_DIR, fileName); - - await remove(filePath); - - await copy(sourceFile, filePath).catch((_err) => {}); - + await copy(sourceFile, join(BIN_DIR, fileName)).catch((_err) => {}); return; } const files = await readdir(BIN_DIR); - await Promise.all( files.filter((name) => name.endsWith(".exe")).map((fileName) => updateFile(fileName)) ); diff --git a/src/renderer/src/components/ui/tour.tsx b/src/renderer/src/components/ui/tour.tsx deleted file mode 100644 index e69de29..0000000