Remove Linux platform selection
This commit is contained in:
@@ -4,17 +4,7 @@ const helpers = require('../../helpers');
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
|
||||
let _platformOverride;
|
||||
|
||||
const getPlatformOverride = () => {
|
||||
return _platformOverride;
|
||||
};
|
||||
|
||||
const setPlatformOverride = (platformOverride) => {
|
||||
_platformOverride = platformOverride;
|
||||
};
|
||||
|
||||
const addListeners = (ipcMain, { detectScript, saveUiSettings }) => {
|
||||
const addListeners = (ipcMain, { detectScript }) => {
|
||||
ipcMain.on(Constants.IPC_Get_Platform, (event) => {
|
||||
const sendResponse = (appPlatform, platform) => {
|
||||
event.sender.send(Constants.IPC_Get_Platform_Reply, {
|
||||
@@ -25,54 +15,42 @@ const addListeners = (ipcMain, { detectScript, saveUiSettings }) => {
|
||||
|
||||
const platform = os.platform();
|
||||
if (platform === 'linux') {
|
||||
if (_platformOverride && _platformOverride.length > 0) {
|
||||
sendResponse(_platformOverride, 'linux');
|
||||
} else {
|
||||
const scriptFile = path.join(os.tmpdir(), 'repertory_detect_linux.sh');
|
||||
fs.writeFileSync(scriptFile, detectScript);
|
||||
const scriptFile = path.join(os.tmpdir(), 'repertory_detect_linux.sh');
|
||||
fs.writeFileSync(scriptFile, detectScript);
|
||||
|
||||
helpers
|
||||
.executeScript(scriptFile)
|
||||
.then((data) => {
|
||||
let appPlatform = data.replace(/(\r\n|\n|\r)/gm, '');
|
||||
if (appPlatform === 'unknown') {
|
||||
helpers.downloadFile(Constants.LINUX_DETECT_SCRIPT_URL, scriptFile, null, (err) => {
|
||||
if (err) {
|
||||
sendResponse(appPlatform, platform);
|
||||
} else {
|
||||
helpers
|
||||
.executeScript(scriptFile)
|
||||
.then((data) => {
|
||||
appPlatform = data.replace(/(\r\n|\n|\r)/gm, '');
|
||||
sendResponse(appPlatform, platform);
|
||||
})
|
||||
.catch(() => {
|
||||
sendResponse(appPlatform, platform);
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
sendResponse(appPlatform, platform);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
sendResponse(platform, platform);
|
||||
});
|
||||
}
|
||||
helpers
|
||||
.executeScript(scriptFile)
|
||||
.then((data) => {
|
||||
let appPlatform = data.replace(/(\r\n|\n|\r)/gm, '');
|
||||
if (appPlatform === 'unknown') {
|
||||
helpers.downloadFile(Constants.LINUX_DETECT_SCRIPT_URL, scriptFile, null, (err) => {
|
||||
if (err) {
|
||||
sendResponse(appPlatform, platform);
|
||||
} else {
|
||||
helpers
|
||||
.executeScript(scriptFile)
|
||||
.then((data) => {
|
||||
appPlatform = data.replace(/(\r\n|\n|\r)/gm, '');
|
||||
sendResponse(appPlatform, platform);
|
||||
})
|
||||
.catch(() => {
|
||||
sendResponse(appPlatform, platform);
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
sendResponse(appPlatform, platform);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
sendResponse(platform, platform);
|
||||
});
|
||||
} else {
|
||||
sendResponse(platform, platform);
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.on(Constants.IPC_Set_Linux_AppPlatform, (event, data) => {
|
||||
setPlatformOverride(data.AppPlatform);
|
||||
saveUiSettings();
|
||||
event.returnValue = true;
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
getPlatformOverride,
|
||||
setPlatformOverride,
|
||||
addListeners,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user