use correct path separator, closes #1308

This commit is contained in:
zadam 2020-10-14 20:42:55 +02:00
parent 1ac1bf12a2
commit 4a76b7a9a5

View file

@ -10,6 +10,7 @@
const os = require('os');
const fs = require('fs');
const path = require('path');
function getAppDataDir() {
let appDataDir = os.homedir(); // fallback if OS is not recognized
@ -43,13 +44,13 @@ function getTriliumDataDir() {
return process.env.TRILIUM_DATA_DIR;
}
const homePath = os.homedir() + "/" + DIR_NAME;
const homePath = os.homedir() + path.sep + DIR_NAME;
if (fs.existsSync(homePath)) {
return homePath;
}
const appDataPath = getAppDataDir() + '/' + DIR_NAME;
const appDataPath = getAppDataDir() + path.sep + DIR_NAME;
if (!fs.existsSync(appDataPath)) {
fs.mkdirSync(appDataPath, 0o700);
@ -59,10 +60,10 @@ function getTriliumDataDir() {
}
const TRILIUM_DATA_DIR = getTriliumDataDir();
const DOCUMENT_PATH = TRILIUM_DATA_DIR + "/document.db";
const BACKUP_DIR = TRILIUM_DATA_DIR + "/backup";
const LOG_DIR = TRILIUM_DATA_DIR + "/log";
const ANONYMIZED_DB_DIR = TRILIUM_DATA_DIR + "/anonymized-db";
const DOCUMENT_PATH = TRILIUM_DATA_DIR + path.sep + "document.db";
const BACKUP_DIR = TRILIUM_DATA_DIR + path.sep + "backup";
const LOG_DIR = TRILIUM_DATA_DIR + path.sep + "log";
const ANONYMIZED_DB_DIR = TRILIUM_DATA_DIR + path.sep + "anonymized-db";
module.exports = {
TRILIUM_DATA_DIR,
@ -70,4 +71,4 @@ module.exports = {
BACKUP_DIR,
LOG_DIR,
ANONYMIZED_DB_DIR
};
};