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();
|
||||
displayVersion();
|
||||
reApplyPeriodically(require('electron-settings').get('settings.reapply_periodically'));
|
||||
if (require('os').platform() === 'win32' && isDevMode()) {
|
||||
if (isWindows() && isDevMode()) {
|
||||
recreateShortcut();
|
||||
}
|
||||
handlePlatformSpecificDisplay();
|
||||
|
@ -193,7 +193,7 @@ function registerRepeaterForAllInput() {
|
||||
* Will display a warning if not.
|
||||
*/
|
||||
function checkForAdminRights() {
|
||||
if (require('os').platform() !== 'win32') {
|
||||
if (!isWindows()) {
|
||||
const isRoot = process.getuid && process.getuid() === 0;
|
||||
if (!isRoot) {
|
||||
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".
|
||||
* @param {string} type "primary", "warning", "danger" or "success".
|
||||
@ -235,7 +242,7 @@ function notification(type, message) {
|
||||
function getRyzenAdjExecutablePath() {
|
||||
const settings = require('electron-settings');
|
||||
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";
|
||||
}
|
||||
appendLog(`getRyzenAdjExecutablePath(): "${ryzen_adj_path}"`);
|
||||
@ -622,7 +629,7 @@ function toggleHpet(value) {
|
||||
*/
|
||||
function handlePlatformSpecificDisplay() {
|
||||
var windows_only_elements = document.getElementsByClassName('windows-only');
|
||||
if (require('os').platform() !== 'win32') {
|
||||
if (!isWindows()) {
|
||||
for (const item of windows_only_elements) {
|
||||
item.setAttribute('hidden', 'true');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user