From eeb1952585b0ec4769047cb005191d0cfca70c40 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Sun, 14 Apr 2024 09:30:51 +0530 Subject: [PATCH] Use --- web/apps/photos/src/services/export/migration.ts | 11 ++++------- web/apps/photos/src/utils/native-fs.ts | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/web/apps/photos/src/services/export/migration.ts b/web/apps/photos/src/services/export/migration.ts index 71c4937d11..50e4218da0 100644 --- a/web/apps/photos/src/services/export/migration.ts +++ b/web/apps/photos/src/services/export/migration.ts @@ -1,3 +1,4 @@ +import { ensureElectron } from "@/next/electron"; import log from "@/next/log"; import { LS_KEYS, getData } from "@ente/shared/storage/localStorage"; import { User } from "@ente/shared/user/types"; @@ -197,6 +198,7 @@ async function migrateCollectionFolders( exportDir: string, collectionIDPathMap: Map, ) { + const fs = ensureElectron().fs; for (const collection of collections) { const oldCollectionExportPath = getOldCollectionFolderPath( exportDir, @@ -208,13 +210,8 @@ async function migrateCollectionFolders( collection.name, ); collectionIDPathMap.set(collection.id, newCollectionExportPath); - if (!(await exportService.exists(oldCollectionExportPath))) { - continue; - } - await exportService.rename( - oldCollectionExportPath, - newCollectionExportPath, - ); + if (!(await fs.exists(oldCollectionExportPath))) continue; + await fs.rename(oldCollectionExportPath, newCollectionExportPath); await addCollectionExportedRecordV1( exportDir, collection.id, diff --git a/web/apps/photos/src/utils/native-fs.ts b/web/apps/photos/src/utils/native-fs.ts index c35c0cd8ff..01b7b18d57 100644 --- a/web/apps/photos/src/utils/native-fs.ts +++ b/web/apps/photos/src/utils/native-fs.ts @@ -81,4 +81,4 @@ export const safeFileName = async (directoryPath: string, name: string) => { * Return true if an item exists an the given {@link path} on the user's local * filesystem. */ -export const exists = (path: string) => ensureElectron().fs.exists(path); +const exists = (path: string) => ensureElectron().fs.exists(path);