From 76e736958f39617e10426a63a5a111b0ff0578a3 Mon Sep 17 00:00:00 2001 From: liamcottle Date: Sun, 2 Jun 2024 14:49:09 +1200 Subject: [PATCH] migrate old storage dir to new storage dir --- electron/main.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/electron/main.js b/electron/main.js index 5136de8..e763089 100644 --- a/electron/main.js +++ b/electron/main.js @@ -79,11 +79,20 @@ app.whenReady().then(async () => { try { + // determine path for storage + const storageDir = path.join(app.getPath('home'), '.reticulum-meshchat'); // ~/.reticulum-meshchat + + // migrate old storage dir to new storage dir + const oldStorageDir = path.join(app.getPath('home'), '.reticulum-webchat'); // ~/.reticulum-webchat + if(fs.existsSync(oldStorageDir) && !fs.existsSync(storageDir)){ + fs.renameSync(oldStorageDir, storageDir); + } + // spawn executable exeChildProcess = await spawn(exe, [ '--headless', // reticulum meshchat usually launches default web browser, we don't want this when using electron '--port', '9337', // FIXME: let system pick a random unused port? - '--storage-dir', path.join(app.getPath('home'), '.reticulum-meshchat'), // ~/.reticulum-meshchat + '--storage-dir', storageDir, ]); // log stdout