I have a .ini file that looks like this:
[Filepath]
Inbound=C:\Users\Bilbo\Desktop\Testing
I want to return that exact string (C:\Users\Bilbo\Desktop\Testing) and I have the following code:
public static String ParseIniInbound (File iniFile) throws
InvalidFileFormatException, IOException {
String iniFileName = iniFile.toString();
Ini ini = new Ini(new File(iniFileName));
String InboundPath= ini.get("Filepath", "Inbound");
return InboundPath;
}
However, what is returned is C:UsersBilboDesktopTesting
I tried putting quotes around the filepath in the .ini file to read it as a string but that didn't work. I used double slashes (C:\\Users\\Bilbo\\Desktop\\Testing) which returns (C:\Users\Bilbo\Desktop\Testing) but I want to be able to just copy and paste a filepath and not have to manually put in double slashes. Is there a way to read in a string from an .ini file with ini4j or another way around this? Thanks