diff --git a/ElectronClient/app.js b/ElectronClient/app.js index c4f0408b2b..02f897779f 100644 --- a/ElectronClient/app.js +++ b/ElectronClient/app.js @@ -1237,9 +1237,14 @@ class Application extends BaseApplication { this.updateMenuItemStates(); // Make it available to the console window - useful to call revisionService.collectRevisions() - window.revisionService = RevisionService.instance(); - window.migrationService = MigrationService.instance(); - window.decryptionWorker = DecryptionWorker.instance(); + window.joplin = () => { + return { + revisionService: RevisionService.instance(), + migrationService: MigrationService.instance(), + decryptionWorker: DecryptionWorker.instance(), + bridge: bridge(), + }; + }; bridge().addEventListener('nativeThemeUpdated', this.bridge_nativeThemeUpdated); } diff --git a/ElectronClient/bridge.js b/ElectronClient/bridge.js index c5a79e6629..43e93bef3e 100644 --- a/ElectronClient/bridge.js +++ b/ElectronClient/bridge.js @@ -1,6 +1,7 @@ const { _, setLocale } = require('lib/locale.js'); const { dirname, toSystemSlashes } = require('lib/path-utils.js'); const { BrowserWindow, nativeTheme } = require('electron'); +const { shim } = require('lib/shim.js'); class Bridge { @@ -187,7 +188,16 @@ class Bridge { // to notify services and component that the app is about to close // but for the current use-case it's not really needed. const { app } = require('electron'); - app.relaunch(); + + if (shim.isPortable()) { + const options = { + execPath: process.env.PORTABLE_EXECUTABLE_FILE, + }; + app.relaunch(options); + } else { + app.relaunch(); + } + app.exit(); }