From 3bf08b09f495d0a6979e067107d58e57fedbe95d Mon Sep 17 00:00:00 2001
From: Alexis Lopez Zubieta <contact@azubieta.net>
Date: Wed, 28 Aug 2019 10:36:51 -0500
Subject: [PATCH] Fix data dir to HOME/.config/OCS-Store

---
 app/main.js | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/app/main.js b/app/main.js
index c6d4809..3ee5874 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;
     }
 });
-- 
GitLab