Solus Linux detection
This commit is contained in:
28
electron.js
28
electron.js
@@ -11,6 +11,10 @@ const helpers = require('./helpers');
|
||||
const fs = require('fs');
|
||||
const unzip = require('unzipper');
|
||||
const AutoLaunch = require('auto-launch');
|
||||
require.extensions['.sh'] = function (module, filename) {
|
||||
module.exports = fs.readFileSync(filename, 'utf8');
|
||||
};
|
||||
const detectScript = require('./public/detect_linux.sh');
|
||||
|
||||
// Keep a global reference of the window object, if you don't, the window will
|
||||
// be closed automatically when the JavaScript object is garbage collected.
|
||||
@@ -577,9 +581,27 @@ ipcMain.on(Constants.IPC_Get_Config_Template, (event, data) => {
|
||||
});
|
||||
|
||||
ipcMain.on(Constants.IPC_Get_Platform, (event) => {
|
||||
event.sender.send(Constants.IPC_Get_Platform_Reply, {
|
||||
data: os.platform()
|
||||
});
|
||||
let platform = os.platform();
|
||||
if (platform === 'linux') {
|
||||
fs.writeFileSync('/tmp/repertory_detect_linux.sh', detectScript);
|
||||
helpers
|
||||
.executeScript('/tmp/repertory_detect_linux.sh')
|
||||
.then(data => {
|
||||
platform = data.replace(/(\r\n|\n|\r)/gm,"");
|
||||
event.sender.send(Constants.IPC_Get_Platform_Reply, {
|
||||
data: platform,
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
event.sender.send(Constants.IPC_Get_Platform_Reply, {
|
||||
data: platform,
|
||||
});
|
||||
});
|
||||
} else {
|
||||
event.sender.send(Constants.IPC_Get_Platform_Reply, {
|
||||
data: platform,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.on(Constants.IPC_Get_State, (event, data) => {
|
||||
|
||||
Reference in New Issue
Block a user