mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-28 10:32:27 +08:00
refactor(data_dir): add FOLDER_PERMISSION const
gets rid of previously "magic number"
This commit is contained in:
parent
fbfee818b2
commit
61a19d5628
@ -32,11 +32,13 @@ function getAppDataDir() {
|
||||
}
|
||||
|
||||
const DIR_NAME = "trilium-data";
|
||||
const FOLDER_PERMISSIONS = 0o700;
|
||||
|
||||
|
||||
function getTriliumDataDir() {
|
||||
if (process.env.TRILIUM_DATA_DIR) {
|
||||
if (!fs.existsSync(process.env.TRILIUM_DATA_DIR)) {
|
||||
fs.mkdirSync(process.env.TRILIUM_DATA_DIR, 0o700);
|
||||
fs.mkdirSync(process.env.TRILIUM_DATA_DIR, FOLDER_PERMISSIONS);
|
||||
}
|
||||
|
||||
return process.env.TRILIUM_DATA_DIR;
|
||||
@ -51,7 +53,7 @@ function getTriliumDataDir() {
|
||||
const appDataPath = getAppDataDir() + path.sep + DIR_NAME;
|
||||
|
||||
if (!fs.existsSync(appDataPath)) {
|
||||
fs.mkdirSync(appDataPath, 0o700);
|
||||
fs.mkdirSync(appDataPath, FOLDER_PERMISSIONS);
|
||||
}
|
||||
|
||||
return appDataPath;
|
||||
|
Loading…
x
Reference in New Issue
Block a user