0

我使用 Inno Setup 5 创建一个带有{app}作为目标的 ini 文件:

[INI]
Filename: "{userdocs}\JavaCppDemo.ini"; Section: "InstallSettings"; Flags: uninsdeletesection
Filename: "{userdocs}\JavaCppDemo.ini"; Section: "InstallSettings"; Key: "InstallPath"; String: "{app}"

然后我使用 ini4j 来获取 InstallPath 的值:

String DefaultFolder = new FileChooser().getFileSystemView().getDefaultDirectory().toString(); 

// tricky way of getting at user/documents folder
String strFileName = DefaultFolder + "\\JavaCppDemo.ini";
Ini ini = null;

try {
   ini = new Ini(new File(DefaultFolder + "\\JavaCppDemo.ini"));
} catch (IOException ex) {
   Logger.getLogger(CppInterface.class.getName()).log(Level.SEVERE, null, ex);
}

String strDatafile;
Ini.Section section = ini.get("InstallSettings");
String installPath = section.get("InstallPath");

问题 installPath 设置为C:UsersEd SowellDocumentsJavaCppDemoLog.txt.

IOW,路径元素分隔符\被剥离。

由于{app}执行设置时用户使用 FileChooser 选择了 的值,因此我没有更改它的选项。

这是 Inno-Setup 和 ini4j 之间已知的不兼容吗?

4

0 回答 0