From 4a76b7a9a5b8b40194ae6d2e14f95a4bfca4caf2 Mon Sep 17 00:00:00 2001 From: zadam Date: Wed, 14 Oct 2020 20:42:55 +0200 Subject: [PATCH] use correct path separator, closes #1308 --- src/services/data_dir.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/services/data_dir.js b/src/services/data_dir.js index a923e5e61..f286faaf6 100644 --- a/src/services/data_dir.js +++ b/src/services/data_dir.js @@ -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 -}; \ No newline at end of file +};