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
@ -23,11 +23,7 @@ module.exports = {
|
|||||||
|
|
||||||
return spawnedProcess;
|
return spawnedProcess;
|
||||||
};
|
};
|
||||||
|
|
||||||
const spawnUpdate = function(args) {
|
|
||||||
return spawn(updateDotExe, args);
|
|
||||||
};
|
|
||||||
|
|
||||||
const squirrelEvent = process.argv[1];
|
const squirrelEvent = process.argv[1];
|
||||||
switch (squirrelEvent) {
|
switch (squirrelEvent) {
|
||||||
case '--squirrel-install':
|
case '--squirrel-install':
|
||||||
@ -36,20 +32,21 @@ module.exports = {
|
|||||||
// - Add your .exe to the PATH
|
// - Add your .exe to the PATH
|
||||||
// - Write to the registry for things like file associations and
|
// - Write to the registry for things like file associations and
|
||||||
// explorer context menus
|
// explorer context menus
|
||||||
|
|
||||||
// Install desktop and start menu shortcuts
|
|
||||||
spawnUpdate(['--createShortcut', exeName]);
|
|
||||||
|
|
||||||
setTimeout(app.quit, 1000);
|
setTimeout(app.quit, 1000);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case '--squirrel-uninstall':
|
case '--squirrel-uninstall':
|
||||||
// Undo anything you did in the --squirrel-install and
|
// Undo anything you did in the --squirrel-install and
|
||||||
// --squirrel-updated handlers
|
// --squirrel-updated handlers
|
||||||
|
|
||||||
// Remove desktop and start menu shortcuts
|
// Removing desktop shortcut
|
||||||
spawnUpdate(['--removeShortcut', exeName]);
|
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);
|
setTimeout(app.quit, 1000);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ ready(function(){
|
|||||||
displayVersion();
|
displayVersion();
|
||||||
reApplyPeriodically(require('electron-settings').get('settings.reapply_periodically'));
|
reApplyPeriodically(require('electron-settings').get('settings.reapply_periodically'));
|
||||||
displayOptionDescription();
|
displayOptionDescription();
|
||||||
|
recreateShortcut();
|
||||||
document.isStarting = false;
|
document.isStarting = false;
|
||||||
settings.set('settings', {
|
settings.set('settings', {
|
||||||
...settings.get('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",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "electron .",
|
"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"
|
"build": "node installers/windows/createinstaller.js"
|
||||||
},
|
},
|
||||||
"repository": "https://gitlab.com/le.storm1er/ryzen-controller",
|
"repository": "https://gitlab.com/le.storm1er/ryzen-controller",
|
||||||
|
Loading…
Reference in New Issue
Block a user