x Potential fix for selecting executables as external browser on Mac and Linux
This commit is contained in:
parent
cdce884844
commit
877bb9448f
|
@ -744,11 +744,24 @@ function onReady(): void {
|
||||||
electron.ipcMain.handle('browser-option-browse', async () => {
|
electron.ipcMain.handle('browser-option-browse', async () => {
|
||||||
log.debug('settings.browserOption.browse');
|
log.debug('settings.browserOption.browse');
|
||||||
console.log('settings.browserOption.browse', JSON.stringify(settings));
|
console.log('settings.browserOption.browse', JSON.stringify(settings));
|
||||||
|
|
||||||
|
const os = require('os');
|
||||||
|
let filters;
|
||||||
|
if(os.platform() === "win32") {
|
||||||
|
filters = [{ name: 'Executables', extensions: ['exe'] }];
|
||||||
|
} else if (os.platform() === "darwin") {
|
||||||
|
filters = [{ name: 'Executables', extensions: ['app'] }];
|
||||||
|
} else {
|
||||||
|
// linux and anything else that might be supported
|
||||||
|
// no specific extension for executables
|
||||||
|
filters = [{ name: 'Executables', extensions: ['*'] }];
|
||||||
|
}
|
||||||
|
|
||||||
const dir = electron.dialog.showOpenDialogSync(
|
const dir = electron.dialog.showOpenDialogSync(
|
||||||
{
|
{
|
||||||
defaultPath: settings.browserPath,
|
defaultPath: settings.browserPath,
|
||||||
properties: ['openFile'],
|
properties: ['openFile'],
|
||||||
filters: [{ name: 'Executables', extensions: ['exe'] }]
|
filters: filters
|
||||||
});
|
});
|
||||||
if(dir !== undefined) {
|
if(dir !== undefined) {
|
||||||
return dir[0];
|
return dir[0];
|
||||||
|
|
Loading…
Reference in New Issue