如何在安装期间加载和使用JSON配置文件?我可以从文件中读取字符串并写入它,但是如果我想在配置文件中更改某些值,我必须使用VBScript.RegExpCOM对象(这很好,但很难开发).
目前的方法:
ExtractTemporaryFile('config.json');
filename := ExpandConstant('{tmp}\config.json');
LoadStringFromFile(filename, conf);
objRegExp := CreateOleObject('VBScript.RegExp');
objRegExp.Pattern := 'test';
conf := objRegExp.Replace(conf, 'test_replace');
SaveStringToFile(filenameOut, conf, False);
Run Code Online (Sandbox Code Playgroud)
有一个更好的方法吗?我只需要替换JSON对象中的一些值,而不是额外的魔法.