Skip to content

Commit

Permalink
Fixed issue #8.
Browse files Browse the repository at this point in the history
  • Loading branch information
Xtrendence committed Nov 29, 2021
1 parent feb8b96 commit a36abbc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/modules/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ module.exports = {
}
return false;
},

getUserDirectory() {
const { app } = require("electron");
return app.getPath("userData");
},

randomIP(clients) {
let ips = Object.keys(clients);
Expand Down
6 changes: 4 additions & 2 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ const port = 2180;
// Needs to be set to true when building the Electron app.
let portable = utils.portableMode(args);

let app;
let app, db;
if(portable) {
app = require("./portableApp");
db = utils.getUserDirectory();
} else {
app = require("./app");
db = "db";
}

const server = app.listen(port);
Expand All @@ -29,7 +31,7 @@ const io = require("socket.io")(server, {
maxHttpBufferSize: 8192 * 1024
});

const dbManager = new DBManager("db");
const dbManager = new DBManager(db);
dbManager.clear();

const connectionManager = new ConnectionManager(io, dbManager, 64, 5000);
Expand Down

0 comments on commit a36abbc

Please sign in to comment.