今天在打包一个软件的时候,需要修改其JSON配置文件,于是用nsJSON插件试了一下。主要用了以下几个功能。
读取json配置文件
nsJSON::Set /file "$APPDATA\config_v2.json"
读取指定节点
nsJSON::Get "setting" "download.savePath" /end
Pop $R0
格式化路径
${WordReplace} "$DOCUMENTS" "\" "\\" "+*" $R0
更新字符串
nsJSON::Set "setting" "download.savePath" /value '"$R0"'
nsJSON::Get "setting" "download.savePath" /end
写入文件
nsJSON::Serialize /format /file "$APPDATA\config_v2.json"
结束。
评论 (0)