Commit 04888860 authored by nanahira's avatar nanahira

rework server init

parent de15fb02
...@@ -59,7 +59,7 @@ add_log = (message) -> ...@@ -59,7 +59,7 @@ add_log = (message) ->
text = mt.format('YYYY-MM-DD HH:mm:ss') + " --> " + message + "\n" text = mt.format('YYYY-MM-DD HH:mm:ss') + " --> " + message + "\n"
res = false res = false
try try
await util.promisify(fs.appendFile)("./logs/"+mt.format('YYYY-MM-DD')+".log", text) await fs.promises.appendFile("./logs/"+mt.format('YYYY-MM-DD')+".log", text)
res = true res = true
catch catch
res = false res = false
...@@ -69,7 +69,7 @@ add_log = (message) -> ...@@ -69,7 +69,7 @@ add_log = (message) ->
default_data = loadJSON('./data/default_data.json') default_data = loadJSON('./data/default_data.json')
setting_save = (settings) -> setting_save = (settings) ->
try try
await util.promisify(fs.writeFile)(settings.file, JSON.stringify(settings, null, 2)) await fs.promises.writeFile(settings.file, JSON.stringify(settings, null, 2))
catch e catch e
add_log("save fail"); add_log("save fail");
return return
......
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
text = mt.format('YYYY-MM-DD HH:mm:ss') + " --> " + message + "\n"; text = mt.format('YYYY-MM-DD HH:mm:ss') + " --> " + message + "\n";
res = false; res = false;
try { try {
await util.promisify(fs.appendFile)("./logs/" + mt.format('YYYY-MM-DD') + ".log", text); await fs.promises.appendFile("./logs/" + mt.format('YYYY-MM-DD') + ".log", text);
res = true; res = true;
} catch (error) { } catch (error) {
res = false; res = false;
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
setting_save = async function(settings) { setting_save = async function(settings) {
var e; var e;
try { try {
await util.promisify(fs.writeFile)(settings.file, JSON.stringify(settings, null, 2)); await fs.promises.writeFile(settings.file, JSON.stringify(settings, null, 2));
} catch (error) { } catch (error) {
e = error; e = error;
add_log("save fail"); add_log("save fail");
......
This diff is collapsed.
This diff is collapsed.
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