mirror of
https://gitlab.com/ryzen-controller-team/ryzen-controller.git
synced 2024-12-22 18:13:28 +07:00
fix(developers): Refactor windows detection.
This commit is contained in:
parent
029ffc2be9
commit
89f9950b59
@ -15,7 +15,7 @@ ready(function(){
|
|||||||
checkForAdminRights();
|
checkForAdminRights();
|
||||||
displayVersion();
|
displayVersion();
|
||||||
reApplyPeriodically(require('electron-settings').get('settings.reapply_periodically'));
|
reApplyPeriodically(require('electron-settings').get('settings.reapply_periodically'));
|
||||||
if (require('os').platform() === 'win32' && isDevMode()) {
|
if (isWindows() && isDevMode()) {
|
||||||
recreateShortcut();
|
recreateShortcut();
|
||||||
}
|
}
|
||||||
handlePlatformSpecificDisplay();
|
handlePlatformSpecificDisplay();
|
||||||
|
@ -193,7 +193,7 @@ function registerRepeaterForAllInput() {
|
|||||||
* Will display a warning if not.
|
* Will display a warning if not.
|
||||||
*/
|
*/
|
||||||
function checkForAdminRights() {
|
function checkForAdminRights() {
|
||||||
if (require('os').platform() !== 'win32') {
|
if (!isWindows()) {
|
||||||
const isRoot = process.getuid && process.getuid() === 0;
|
const isRoot = process.getuid && process.getuid() === 0;
|
||||||
if (!isRoot) {
|
if (!isRoot) {
|
||||||
notification('danger',
|
notification('danger',
|
||||||
@ -214,6 +214,13 @@ function checkForAdminRights() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check that the app is running on Windows.
|
||||||
|
*/
|
||||||
|
function isWindows() {
|
||||||
|
return require('os').platform() === 'win32';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will display a notification in ".notification-zone".
|
* Will display a notification in ".notification-zone".
|
||||||
* @param {string} type "primary", "warning", "danger" or "success".
|
* @param {string} type "primary", "warning", "danger" or "success".
|
||||||
@ -235,7 +242,7 @@ function notification(type, message) {
|
|||||||
function getRyzenAdjExecutablePath() {
|
function getRyzenAdjExecutablePath() {
|
||||||
const settings = require('electron-settings');
|
const settings = require('electron-settings');
|
||||||
var ryzen_adj_path = settings.get('settings.ryzen_adj_path');
|
var ryzen_adj_path = settings.get('settings.ryzen_adj_path');
|
||||||
if (!ryzen_adj_path && require('os').platform() === 'win32') {
|
if (!ryzen_adj_path && isWindows()) {
|
||||||
ryzen_adj_path = getCurrentWorkingDirectory() + "\\bin\\ryzenadj.exe";
|
ryzen_adj_path = getCurrentWorkingDirectory() + "\\bin\\ryzenadj.exe";
|
||||||
}
|
}
|
||||||
appendLog(`getRyzenAdjExecutablePath(): "${ryzen_adj_path}"`);
|
appendLog(`getRyzenAdjExecutablePath(): "${ryzen_adj_path}"`);
|
||||||
@ -622,7 +629,7 @@ function toggleHpet(value) {
|
|||||||
*/
|
*/
|
||||||
function handlePlatformSpecificDisplay() {
|
function handlePlatformSpecificDisplay() {
|
||||||
var windows_only_elements = document.getElementsByClassName('windows-only');
|
var windows_only_elements = document.getElementsByClassName('windows-only');
|
||||||
if (require('os').platform() !== 'win32') {
|
if (!isWindows()) {
|
||||||
for (const item of windows_only_elements) {
|
for (const item of windows_only_elements) {
|
||||||
item.setAttribute('hidden', 'true');
|
item.setAttribute('hidden', 'true');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user