New Gallery: create directory if doesn't exist!#120

This commit is contained in:
Paolo Arena
2019-12-28 14:30:30 +01:00
parent 523edf557b
commit 0c91e6ce0b
3 changed files with 101 additions and 52 deletions

View File

@@ -571,6 +571,19 @@ module.exports = {
}
callback();
});
}
},
};
mkdirpath(dirPath) {
// if (!fs.accessSync(dirPath, fs.constants.R_OK | fs.constants.W_OK)) {
if (!fs.existsSync(dirPath)){
try {
fs.mkdirSync(dirPath, { recursive: true });
}
catch (e) {
mkdirpath(path.dirname(dirPath));
mkdirpath(dirPath);
}
}
},
};