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

Load ctrl/modopts/module-suffix.ini instead of ctrl/modopts/module:suffix.ini

Colons are problematic in Windows filenames, so convert colon to dash, if
provided in the modname (e.g. qnet-ftp:qwk-id).

Also noticed the default option value didn't work for ctrl/modopts/*.ini files
(when requesting one specific property) - fixed that.
parent a1edc650
No related branches found
No related tags found
No related merge requests found
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
"use strict"; "use strict";
function get_mod_options(modname, optname, default_optval) function get_mod_options(modname, optname, default_optval)
{ {
var ini_file = new File(system.ctrl_dir + "modopts/" + modname + ".ini"); var ini_file = new File(system.ctrl_dir + "modopts/" + modname.replace(":", "-") + ".ini");
if(ini_file.open("r")) { if(ini_file.open("r")) {
var obj = ini_file.iniGetObject(/* lowercase */false, /* blanks: */true); var obj = ini_file.iniGetObject(/* lowercase */false, /* blanks: */true);
var sections = ini_file.iniGetSections(); var sections = ini_file.iniGetSections();
...@@ -54,7 +54,7 @@ function get_mod_options(modname, optname, default_optval) ...@@ -54,7 +54,7 @@ function get_mod_options(modname, optname, default_optval)
} }
ini_file.close(); ini_file.close();
if(optname) if(optname)
return obj[optname]; return (obj[optname] === undefined) ? default_optval : obj[optname];
return obj; return obj;
} }
ini_file = new File(file_cfgname(system.ctrl_dir, "modopts.ini")); ini_file = new File(file_cfgname(system.ctrl_dir, "modopts.ini"));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment