mirror of
https://github.com/A-Star100/simpliplay-desktop.git
synced 2025-09-18 06:39:44 +00:00
App now handles whenever an addon doesn't exist
This commit is contained in:
parent
238684b167
commit
b5a6bf1866
@ -6,7 +6,7 @@ const { pathToFileURL } = require("url");
|
|||||||
const { checkForUpdate } = require('./updateChecker');
|
const { checkForUpdate } = require('./updateChecker');
|
||||||
let gpuAccel = "";
|
let gpuAccel = "";
|
||||||
let didRegisterShortcuts = false;
|
let didRegisterShortcuts = false;
|
||||||
let version = "2.0.4.0"
|
let version = "2.0.4.1"
|
||||||
|
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
if (process.argv.includes('--use-gl')) {
|
if (process.argv.includes('--use-gl')) {
|
||||||
@ -245,8 +245,8 @@ if (existingAddonsMenuItem) {
|
|||||||
if (alreadyLoaded) {
|
if (alreadyLoaded) {
|
||||||
await dialog.showMessageBox(mainWindow, {
|
await dialog.showMessageBox(mainWindow, {
|
||||||
type: 'error',
|
type: 'error',
|
||||||
title: 'Add-on Load Error',
|
title: 'Could not load addon',
|
||||||
message: `An add-on named "${fileName}" is already loaded.`,
|
message: `An add-on named "${fileName}" has already been loaded before.`,
|
||||||
buttons: ['OK']
|
buttons: ['OK']
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
@ -261,7 +261,24 @@ if (existingAddonsMenuItem) {
|
|||||||
checked: true,
|
checked: true,
|
||||||
click: (menuItem) => {
|
click: (menuItem) => {
|
||||||
if (menuItem.checked) {
|
if (menuItem.checked) {
|
||||||
|
fs.access(filePath, (err) => {
|
||||||
|
if (!err) {
|
||||||
mainWindow.webContents.send('load-addon', fileURL);
|
mainWindow.webContents.send('load-addon', fileURL);
|
||||||
|
} else {
|
||||||
|
dialog.showMessageBox(mainWindow, {
|
||||||
|
type: 'error',
|
||||||
|
title: 'Could not load addon',
|
||||||
|
message: `The add-on "${fileName}" could not be found or doesn't exist anymore.`,
|
||||||
|
buttons: ['OK']
|
||||||
|
}).then(() => {
|
||||||
|
// Delay unchecking to ensure dialog closes first
|
||||||
|
setTimeout(() => {
|
||||||
|
menuItem.checked = false;
|
||||||
|
}, 100);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
mainWindow.webContents.send('unload-addon', fileURL);
|
mainWindow.webContents.send('unload-addon', fileURL);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user