Commit aa69147c authored by nanahira's avatar nanahira

fix download replay

parent b2ff4353
...@@ -99,10 +99,10 @@ checkFileExists = (path) => ...@@ -99,10 +99,10 @@ checkFileExists = (path) =>
catch e catch e
return false return false
createDirectoryIfNotExists = (path) => createDirectoryIfNotExists = (dirPath) =>
try try
if path and !await checkFileExists(path) if dirPath and !await checkFileExists(dirPath)
await fs.promises.mkdir(path, {recursive: true}) await fs.promises.mkdir(dirPath, {recursive: true})
catch e catch e
log.warn("Failed to create directory #{path}: #{e.toString()}") log.warn("Failed to create directory #{path}: #{e.toString()}")
...@@ -603,8 +603,8 @@ init = () -> ...@@ -603,8 +603,8 @@ init = () ->
settings.modules.deck_log.local settings.modules.deck_log.local
] ]
for path in mkdirList for dirPath in mkdirList
await createDirectoryIfNotExists(path) await createDirectoryIfNotExists(dirPath)
plugin_list = await fs.promises.readdir("./plugins") plugin_list = await fs.promises.readdir("./plugins")
for plugin_filename in plugin_list for plugin_filename in plugin_list
......
...@@ -94,11 +94,11 @@ ...@@ -94,11 +94,11 @@
} }
}; };
createDirectoryIfNotExists = async(path) => { createDirectoryIfNotExists = async(dirPath) => {
var e; var e;
try { try {
if (path && !(await checkFileExists(path))) { if (dirPath && !(await checkFileExists(dirPath))) {
return (await fs.promises.mkdir(path, { return (await fs.promises.mkdir(dirPath, {
recursive: true recursive: true
})); }));
} }
...@@ -297,7 +297,7 @@ ...@@ -297,7 +297,7 @@
}; };
init = async function() { init = async function() {
var AthleticChecker, DataManager, challonge_module_name, challonge_type, chat_color, config, cppversion, defaultConfig, default_data, dns, e, http_server, https, https_server, imported, j, l, len, len1, len2, m, mkdirList, options, pgClient, pg_client, pg_query, plugin_filename, plugin_list, plugin_path, postData, ref; var AthleticChecker, DataManager, challonge_module_name, challonge_type, chat_color, config, cppversion, defaultConfig, default_data, dirPath, dns, e, http_server, https, https_server, imported, j, l, len, len1, len2, m, mkdirList, options, pgClient, pg_client, pg_query, plugin_filename, plugin_list, plugin_path, postData, ref;
await createDirectoryIfNotExists("./config"); await createDirectoryIfNotExists("./config");
await importOldConfig(); await importOldConfig();
defaultConfig = (await loadJSONAsync('./data/default_config.json')); defaultConfig = (await loadJSONAsync('./data/default_config.json'));
...@@ -770,8 +770,8 @@ ...@@ -770,8 +770,8 @@
} }
mkdirList = ["./plugins", settings.modules.tournament_mode.deck_path, settings.modules.tournament_mode.replay_path, settings.modules.tournament_mode.log_save_path, settings.modules.deck_log.local]; mkdirList = ["./plugins", settings.modules.tournament_mode.deck_path, settings.modules.tournament_mode.replay_path, settings.modules.tournament_mode.log_save_path, settings.modules.deck_log.local];
for (l = 0, len1 = mkdirList.length; l < len1; l++) { for (l = 0, len1 = mkdirList.length; l < len1; l++) {
path = mkdirList[l]; dirPath = mkdirList[l];
await createDirectoryIfNotExists(path); await createDirectoryIfNotExists(dirPath);
} }
plugin_list = (await fs.promises.readdir("./plugins")); plugin_list = (await fs.promises.readdir("./plugins"));
for (m = 0, len2 = plugin_list.length; m < len2; m++) { for (m = 0, len2 = plugin_list.length; m < len2; m++) {
......
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