Based on that. I've made a set of wrapper functions to handle config file openning and realoding.
Code: Select all
use uo;
use cfgfile;
function GetConfigFileRef(cf_prop, file_string)
var r := GetGlobalProperty(cf_prop);
if(r == error)
r:= ReadConfigFile(file_string);
SetGlobalProperty(cf_prop, r);
endif
return r;
endfunction
function ForceConfigFileReload(cf_prop, file_string)
UnloadConfigFile(file_string);
SetGlobalProperty(cf_prop, error);
endfunctionForceConfigFileReload is going to unload that config file and make an error to be placed at the global prop so that GetConfigFileRef gets a new reference next time it's called.
I did this to avoid unnecessary reloading of config files. This seems too good. But... Are there problems? I mean, is there anything that could go wrong by doing this?
Another question. What happens if I call ReadConfigFile() more than once for the same file?