Skip to content
Snippets Groups Projects
Commit 8c6fa14a authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Fix "error 13 opening" files when using init-fidonet.js

I finally reproduced this issue myself on a fresh install on Windows.

We needed explicit file closing here as going out of scope doesn't immediately
finalize (and close) a File object. That may not happen until garbage
collection and thus prevent subsequent re-opens of the same files, so always
close() your files.

init-fidonet.js calls install-binkit.js which uses cfglib.js, so that was
a source of these errors too.
parent d1ee6b86
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
...@@ -251,6 +251,7 @@ function get_domain(zone) ...@@ -251,6 +251,7 @@ function get_domain(zone)
continue; continue;
if(typeof zones == 'number') { if(typeof zones == 'number') {
if(zone == zones) { if(zone == zones) {
file.close();
return netname; return netname;
} }
continue; continue;
...@@ -258,6 +259,7 @@ function get_domain(zone) ...@@ -258,6 +259,7 @@ function get_domain(zone)
zones = zones.split(','); zones = zones.split(',');
for(var j = 0; j < zones.length; j++) { for(var j = 0; j < zones.length; j++) {
if(zone == zones[j]) { if(zone == zones[j]) {
file.close();
return netname; return netname;
} }
} }
...@@ -265,6 +267,7 @@ function get_domain(zone) ...@@ -265,6 +267,7 @@ function get_domain(zone)
file.close(); file.close();
return result; return result;
} }
file.close();
return ""; return "";
} }
...@@ -638,6 +641,7 @@ if(!msgs_ini.iniGetObject("grp:" + netname) ...@@ -638,6 +641,7 @@ if(!msgs_ini.iniGetObject("grp:" + netname)
? (netname.toUpperCase() + "_") : network.areatag_prefix ? (netname.toUpperCase() + "_") : network.areatag_prefix
}); });
} }
msgs_ini.close();
/*********************/ /*********************/
/* DOWNLOAD ECHOLIST */ /* DOWNLOAD ECHOLIST */
......
...@@ -19,6 +19,7 @@ function read_main_ini(filename) ...@@ -19,6 +19,7 @@ function read_main_ini(filename)
obj.mqtt = f.iniGetObject("MQTT"); obj.mqtt = f.iniGetObject("MQTT");
obj.module = f.iniGetObject("module"); obj.module = f.iniGetObject("module");
obj.shell = read_sections(f, "shell:"); obj.shell = read_sections(f, "shell:");
f.close();
return obj; return obj;
} }
...@@ -33,6 +34,7 @@ function read_file_ini(filename) ...@@ -33,6 +34,7 @@ function read_file_ini(filename)
obj.viewer = read_sections(f, "viewer:"); obj.viewer = read_sections(f, "viewer:");
obj.tester = read_sections(f, "tester:"); obj.tester = read_sections(f, "tester:");
obj.protocol = read_sections(f, "protocol:"); obj.protocol = read_sections(f, "protocol:");
f.close();
return obj; return obj;
} }
...@@ -69,6 +71,7 @@ function read_xtrn_ini(filename) ...@@ -69,6 +71,7 @@ function read_xtrn_ini(filename)
item.code = item.code.substring(i + 1); item.code = item.code.substring(i + 1);
} }
} }
f.close();
return obj; return obj;
} }
...@@ -101,6 +104,7 @@ function write_xtrn_ini(filename, obj) ...@@ -101,6 +104,7 @@ function write_xtrn_ini(filename, obj)
write_sections(f, obj.sec, "sec:"); write_sections(f, obj.sec, "sec:");
write_sections(f, obj.prog, "prog:"); write_sections(f, obj.prog, "prog:");
write_sections(f, obj.native, "native:"); write_sections(f, obj.native, "native:");
f.close();
return true; return true;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment