Commit 91ce5003 authored by nanahira's avatar nanahira

fix mkdir

parent 12055d02
Pipeline #1246 passed with stage
in 6 minutes and 59 seconds
...@@ -100,8 +100,11 @@ checkFileExists = (path) => ...@@ -100,8 +100,11 @@ checkFileExists = (path) =>
return false return false
createDirectoryIfNotExists = (path) => createDirectoryIfNotExists = (path) =>
if !await checkFileExists(path) try
await fs.promises.mkdir(path, {recursive: true}) if path and !await checkFileExists(path)
await fs.promises.mkdir(path, {recursive: true})
catch e
log.warn("Failed to create directory #{path}: #{e.toString()}")
setting_save = global.setting_save = (settings) -> setting_save = global.setting_save = (settings) ->
try try
......
...@@ -95,10 +95,16 @@ ...@@ -95,10 +95,16 @@
}; };
createDirectoryIfNotExists = async(path) => { createDirectoryIfNotExists = async(path) => {
if (!(await checkFileExists(path))) { var e;
return (await fs.promises.mkdir(path, { try {
recursive: true if (path && !(await checkFileExists(path))) {
})); return (await fs.promises.mkdir(path, {
recursive: true
}));
}
} catch (error1) {
e = error1;
return log.warn(`Failed to create directory ${path}: ${e.toString()}`);
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment