inno setup 5 ini4j strips backslash

2019-08-26 03:44发布

问题:

I use Inno Setup 5 to create an ini file with {app} as the destination:

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

Then I use ini4j to get the value of 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");

The problem installPath gets set to C:UsersEd SowellDocumentsJavaCppDemoLog.txt.

IOW, the path element separator \ gets stripped out.

Since the value of {app} is selected by the user with FileChooser when the setup is executed , I don't have the option of changing it.

Is this a known incompatibility between Inno-Setup and ini4j?