aboutsummaryrefslogtreecommitdiff
path: root/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'app.js')
-rw-r--r--app.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/app.js b/app.js
index 1c02825..da35e78 100644
--- a/app.js
+++ b/app.js
@@ -51,9 +51,9 @@ const { app, BrowserWindow } = require('electron');
process.on('uncaughtException', (error) => {
console.log(" * Starting recovery procedure: E_ERROR");
- id = new Date().toISOString();
+ id = new Date().toISOString().replaceAll(":", "-");
- require('fs').writeFileSync(homedir + "/.kartik/crashes/" + id + ".txt", "Kartik Bootstraper Crash\n\n" + error.stack);
+ require('fs').writeFileSync(require('os').userInfo().homedir + "/.kartik/crashes/" + id + ".txt", "Kartik Bootstraper Crash\n\n" + error.stack);
if (require('os').platform() === "win32") {
require('child_process').exec("runtime\\kartik-crash.bat " + id);
} else if (require('os').platform() === "darwin") {
@@ -278,6 +278,17 @@ const { app, BrowserWindow } = require('electron');
musicIpc.on('preunfademusic', (event, value) => {
win.webContents.send('unfademusic', value);
})
+
+ stats = require(homedir + "/.kartik/stats.json");
+ musicIpc.on('addstats', (event, value) => {
+ stats[value.catalog][value.key] = stats[value.catalog][value.key] + value.add;
+ fs.writeFile(homedir + "/.kartik/stats.json", JSON.stringify(stats), () => {});
+ })
+ musicIpc.on('addstatsandclose', (event, value) => {
+ stats[value.catalog][value.key] = stats[value.catalog][value.key] + value.add;
+ fs.writeFile(homedir + "/.kartik/stats.json", JSON.stringify(stats), () => {});
+ win.destroy();
+ })
})
}