inno setup 5 ini4j strips backslash

試著忘記壹切 提交于 2020-01-26 02:19:46

问题


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?

来源:https://stackoverflow.com/questions/30651304/inno-setup-5-ini4j-strips-backslash

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!