mirror of
https://github.com/CringeStudios/element-desktop.git
synced 2025-01-31 13:39:58 +01:00
Fix issue with Squirrel.Windows install/update handler not firing properly
This commit is contained in:
parent
15600584ec
commit
984a98b9df
@ -17,12 +17,8 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Squirrel on windows starts the app with various flags
|
// Squirrel on windows starts the app with various flags as hooks to tell us when we've been installed/uninstalled etc.
|
||||||
// as hooks to tell us when we've been installed/uninstalled
|
import "./squirrelhooks";
|
||||||
// etc.
|
|
||||||
import { checkSquirrelHooks } from "./squirrelhooks";
|
|
||||||
if (checkSquirrelHooks()) process.exit(1);
|
|
||||||
|
|
||||||
import { app, ipcMain, powerSaveBlocker, BrowserWindow, Menu, autoUpdater, protocol, dialog } from "electron";
|
import { app, ipcMain, powerSaveBlocker, BrowserWindow, Menu, autoUpdater, protocol, dialog } from "electron";
|
||||||
import AutoLaunch from "auto-launch";
|
import AutoLaunch from "auto-launch";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
@ -33,15 +33,13 @@ function runUpdateExe(args: string[]): Promise<void> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function checkSquirrelHooks(): boolean {
|
function checkSquirrelHooks(): boolean {
|
||||||
if (process.platform !== 'win32') return false;
|
if (process.platform !== 'win32') return false;
|
||||||
|
|
||||||
const cmd = process.argv[1];
|
const cmd = process.argv[1];
|
||||||
const target = path.basename(process.execPath);
|
const target = path.basename(process.execPath);
|
||||||
if (cmd === '--squirrel-install' || cmd === '--squirrel-updated') {
|
if (cmd === '--squirrel-install' || cmd === '--squirrel-updated') {
|
||||||
Promise.resolve().then(() => {
|
runUpdateExe(['--createShortcut=' + target]).then(() => {
|
||||||
return runUpdateExe(['--createShortcut=' + target]);
|
|
||||||
}).then(() => {
|
|
||||||
// remove the old 'Riot' shortcuts, if they exist (update.exe --removeShortcut doesn't work
|
// remove the old 'Riot' shortcuts, if they exist (update.exe --removeShortcut doesn't work
|
||||||
// because it always uses the name of the product as the name of the shortcut: the only variable
|
// because it always uses the name of the product as the name of the shortcut: the only variable
|
||||||
// is what executable you're linking to)
|
// is what executable you're linking to)
|
||||||
@ -82,3 +80,7 @@ export function checkSquirrelHooks(): boolean {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (checkSquirrelHooks()) {
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user