diff --git a/app/main.js b/app/main.js index c6d48096f65e987bf199ee8b1e033d7eb1ca10af..3ee5874918b475fc29a4ddf060cfbd1b75d59f68 100644 --- a/app/main.js +++ b/app/main.js @@ -107,8 +107,7 @@ function isFile(path) { try { const stats = fs.statSync(path); return stats.isFile(); - } - catch (error) { + } catch (error) { console.error(error); return false; } @@ -118,8 +117,7 @@ function isDirectory(path) { try { const stats = fs.statSync(path); return stats.isDirectory(); - } - catch (error) { + } catch (error) { console.error(error); return false; } @@ -159,8 +157,7 @@ function removePreviewpic(itemKey) { app.on('ready', async () => { if (await startOcsManager()) { createWindow(); - } - else { + } else { app.quit(); } }); @@ -192,6 +189,9 @@ app.on('web-contents-created', (event, webContents) => { } }); +// Set configs dir +app.setPath("userData", app.getPath("appData") + "/OCS-Store") + ipcMain.on('app', (event, key) => { const data = { package: appPackage, @@ -220,19 +220,15 @@ ipcMain.on('store', (event, key, value) => { ipcMain.on('previewpic', (event, kind, itemKey, url) => { if (kind === 'directory') { event.returnValue = previewpicDirectory; - } - else if (kind === 'path' && itemKey) { + } else if (kind === 'path' && itemKey) { event.returnValue = `${previewpicDirectory}/${previewpicFilename(itemKey)}`; - } - else if (kind === 'download' && itemKey && url) { + } else if (kind === 'download' && itemKey && url) { downloadPreviewpic(itemKey, url); event.returnValue = undefined; - } - else if (kind === 'remove' && itemKey) { + } else if (kind === 'remove' && itemKey) { removePreviewpic(itemKey); event.returnValue = undefined; - } - else { + } else { event.returnValue = false; } });