mirror of
https://gitlab.com/ryzen-controller-team/ryzen-controller.git
synced 2024-12-22 18:13:28 +07:00
Added launch as administrator.
Squirrel.windows can't handle shortcut automatically ... now I know why :(
This commit is contained in:
parent
7dae904e6e
commit
399ea66d31
@ -24,10 +24,6 @@ module.exports = {
|
||||
return spawnedProcess;
|
||||
};
|
||||
|
||||
const spawnUpdate = function(args) {
|
||||
return spawn(updateDotExe, args);
|
||||
};
|
||||
|
||||
const squirrelEvent = process.argv[1];
|
||||
switch (squirrelEvent) {
|
||||
case '--squirrel-install':
|
||||
@ -37,9 +33,6 @@ module.exports = {
|
||||
// - Write to the registry for things like file associations and
|
||||
// explorer context menus
|
||||
|
||||
// Install desktop and start menu shortcuts
|
||||
spawnUpdate(['--createShortcut', exeName]);
|
||||
|
||||
setTimeout(app.quit, 1000);
|
||||
return true;
|
||||
|
||||
@ -47,8 +40,12 @@ module.exports = {
|
||||
// Undo anything you did in the --squirrel-install and
|
||||
// --squirrel-updated handlers
|
||||
|
||||
// Remove desktop and start menu shortcuts
|
||||
spawnUpdate(['--removeShortcut', exeName]);
|
||||
// Removing desktop shortcut
|
||||
let fs = require('fs');
|
||||
var shortcut_path = app.getPath('desktop') + "\\Ryzen Controller";
|
||||
if (!fs.existsSync(shortcut_path)) {
|
||||
fs.unlink(shortcut_path, console.log);
|
||||
}
|
||||
|
||||
setTimeout(app.quit, 1000);
|
||||
return true;
|
||||
|
@ -9,6 +9,7 @@ ready(function(){
|
||||
displayVersion();
|
||||
reApplyPeriodically(require('electron-settings').get('settings.reapply_periodically'));
|
||||
displayOptionDescription();
|
||||
recreateShortcut();
|
||||
document.isStarting = false;
|
||||
settings.set('settings', {
|
||||
...settings.get('settings'),
|
||||
|
@ -282,3 +282,32 @@ function displayOptionDescription() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Will recreate shortcut on launch ... no other solution for now :(
|
||||
*/
|
||||
function recreateShortcut() {
|
||||
const settings = require('electron-settings');
|
||||
|
||||
if (!!settings.get('settings.first_launch')) {
|
||||
let app = require('electron').remote.app;
|
||||
let fs = require('fs');
|
||||
try {
|
||||
var shortcut_path = app.getPath('desktop') + "\\Ryzen Controller";
|
||||
if (!fs.existsSync(shortcut_path)) {
|
||||
fs.unlink(shortcut_path, console.log);
|
||||
fs.symlink(app.getPath('exe'), shortcut_path, function (err) {
|
||||
if (err) {
|
||||
notification("danger", "Shortcut can't be created, please check log tabs for more info.");
|
||||
appendLog(`recreateShortcut(): ${err}`);
|
||||
}
|
||||
else {
|
||||
notification('primary', "A shortcut has been created on desktop.");
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
appendLog(`recreateShortcut() ${error}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
"start": "electron .",
|
||||
"package": "electron-packager . --overwrite --platform=win32 --arch=ia32 --prune=true --out=release-builds --ignore=\".*-builds\" --icon=\"assets/icon.ico\"",
|
||||
"package": "electron-packager . --overwrite --platform=win32 --arch=ia32 --prune=true --out=release-builds --ignore=\".*-builds\" --icon=\"assets/icon.ico\" --win32metadata.requested-execution-level=requireAdministrator",
|
||||
"build": "node installers/windows/createinstaller.js"
|
||||
},
|
||||
"repository": "https://gitlab.com/le.storm1er/ryzen-controller",
|
||||
|
Loading…
Reference in New Issue
Block a user