Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

Electron cache moved to AppName folder #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const {app, BrowserWindow, ipcMain, Menu, MenuItem, Tray, dialog, Notification}
const consts = require('./src/consts.js')
const client = require('./src/client.js').init()
const rl = require('readline').createInterface({input: client.socket})
const path = require('path')

let callbacks = {};
let counters = {};
Expand Down Expand Up @@ -43,6 +44,9 @@ for (let i = idx; i < process.argv.length; i++) {
app.commandLine.appendSwitch(s, v);
}

// App Cache Path
app.setPath('userData', path.join(process.env.APPDATA || (process.platform == 'darwin' ? process.env.HOME + 'Library/Preferences' : process.env.HOME + "/.local/share"), process.argv[4] || "astilectron"));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like using process.argv[4] to set the cache path.

However I'd rather have its value fully determined on GO side and simplifying here to

app.setPath('userData', process.argv[4]);


// App is quitting
app.on('before-quit', () => quittingApp = true);

Expand Down