From 235b7e77d5bf97f92bca2c149b412483acfa568d Mon Sep 17 00:00:00 2001 From: Quentin DECAUNES Date: Mon, 11 Mar 2019 12:58:24 +0100 Subject: [PATCH] Crossplatform check right. --- js/methods.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/js/methods.js b/js/methods.js index 812838e..43b3bb6 100644 --- a/js/methods.js +++ b/js/methods.js @@ -66,16 +66,26 @@ function registerRepeaterForAllInput() { * Will display a warning if not. */ function checkForAdminRights() { + if (require('os').platform !== 'win32') { + const isRoot = process.getuid && process.getuid() === 0; + if (!isRoot) { + notification('danger', + `Warning: you must launch this app as administrator.
` + + `Use "sudo ryzencontroller" from terminal to fix this.` + ); + } + } else { var exec = require('child_process').exec; exec('NET SESSION', function(err,so,se) { if (se.length !== 0) { notification('warning', - `Warning: you should launch this app as administrator,` + `Warning: you should launch this app as administrator, ` + `ryzenadj.exe doesn't seems to work correctly without administrator rights.` ); } }); } +} /** * Will display a notification in ".notification-zone".