[General] Add system electron support fixes

This commit is contained in:
Ducko 2021-12-22 19:06:57 +00:00
parent e371d6b106
commit 7598051419
2 changed files with 12 additions and 1 deletions

View file

@ -9,7 +9,7 @@ const desktopPath = path.join(autostartDir, (app.name ? app.name : app.getName()
// Vars for use in desktop file content template // Vars for use in desktop file content template
const appName = path.basename(process.execPath, '.exe'); const appName = path.basename(process.execPath, '.exe');
const exePath = app.getPath('exe'); const exePath = global.systemElectron ? '/usr/share/pixmaps/Discord' : app.getPath('exe');
const iconPath = path.join(path.dirname(exePath), 'discord.png'); const iconPath = path.join(path.dirname(exePath), 'discord.png');
// Template for desktop file // Template for desktop file

View file

@ -4,6 +4,17 @@ global.oaVersion = 'nightly';
log('Init', 'OpenAsar v' + oaVersion); log('Init', 'OpenAsar v' + oaVersion);
log('Init', 'Resources Path:', process.resourcesPath);
if (process.resourcesPath === '/usr/lib/electron/resources') { // Using system electron, fix process.resourcesPath
log('Init', 'Detected System Electron, fixing paths');
global.systemElectron = true;
const { join } = require('path');
process.resourcesPath = join(__dirname, '..');
log('Init', 'Resources Path:', process.resourcesPath);
}
const appSettings = require('./appSettings'); const appSettings = require('./appSettings');
global.oaConfig = appSettings.getSettings().get('openasar', {}); global.oaConfig = appSettings.getSettings().get('openasar', {});