Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(electron): close db before move db file

LongYinan717dd93f3775
diff --git a/apps/electron/layers/main/src/handlers/dialog/dialog.ts b/apps/electron/layers/main/src/handlers/dialog/dialog.ts
index ec6ce4b54e..ff696a8f94 100644
--- a/apps/electron/layers/main/src/handlers/dialog/dialog.ts
+++ b/apps/electron/layers/main/src/handlers/dialog/dialog.ts
@@ -269,6 +269,8 @@ export async function moveDBFile(
};
}
+ db.db.close();
+
if (isLink) {
// remove the old link to unblock new link
await fs.unlink(db.path);
@@ -278,8 +280,6 @@ export async function moveDBFile(
overwrite: true,
});
- db.db.close();
-
await fs.ensureSymlink(newFilePath, db.path, 'file');
logger.info(`openMoveDBFileDialog symlink: ${realpath} -> ${newFilePath}`);
db.reconnectDB();