Поправки багов в создании каталогов
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const utils = require('../core/utils');
|
||||||
|
|
||||||
const branchFilename = __dirname + '/application_env';
|
const branchFilename = __dirname + '/application_env';
|
||||||
|
|
||||||
@@ -15,4 +16,8 @@ const confFilename = __dirname + `/${branch}.js`;
|
|||||||
|
|
||||||
fs.accessSync(confFilename);
|
fs.accessSync(confFilename);
|
||||||
|
|
||||||
module.exports = require(confFilename);
|
const config = require(confFilename);
|
||||||
|
|
||||||
|
utils.mkDirIfNotExistsSync(config.dataDir);
|
||||||
|
|
||||||
|
module.exports = config;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const base = require('./base');
|
const base = require('./base');
|
||||||
|
|
||||||
const execPath = path.dirname(process.execPath);
|
const execDir = path.dirname(process.execPath);
|
||||||
const dataDir = `${execDir}/data`;
|
const dataDir = `${execDir}/data`;
|
||||||
|
|
||||||
module.exports = Object.assign({}, base, {
|
module.exports = Object.assign({}, base, {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ function statPathSync(path) {
|
|||||||
function mkDirIfNotExistsSync(path) {
|
function mkDirIfNotExistsSync(path) {
|
||||||
let exists = statPathSync(path);
|
let exists = statPathSync(path);
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
fs.mkdirSync(path, {recursive: true, mode: 0o755});
|
fs.mkdirSync(path, {recursive: true});
|
||||||
} else if (!exists.isDirectory()) {
|
} else if (!exists.isDirectory()) {
|
||||||
throw new Error(`Not a directory: ${path}`);
|
throw new Error(`Not a directory: ${path}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user