create trilium data directory if it doesn't exist, closes #491

This commit is contained in:
zadam 2019-04-21 09:05:55 +02:00
parent f0e22b70f6
commit 36c6376220

View file

@ -36,6 +36,10 @@ const DIR_NAME = 'trilium-data';
function getTriliumDataDir() {
if (process.env.TRILIUM_DATA_DIR) {
if (!fs.existsSync(process.env.TRILIUM_DATA_DIR)) {
fs.mkdirSync(process.env.TRILIUM_DATA_DIR, 0o700);
}
return process.env.TRILIUM_DATA_DIR;
}