java - Write UNC path to INI file in "Windows format" -
i want write unc path third party windows application (coreldrawx6) in ini file. since ini file contains sections use ini4j handle it. prupose want change path in file, third party app use path when open "export" dialog (standard windows open dialog). third party app stores file windows registry file format (magic-number ff fe). had twaek reading of file bit. (utf16 + magicnumber in first line) third party app don't use normal urls (file:// or smb://)
the problem have got in written in ini file unc path java escapes:
initial dir = \\\\nas_sl\\daten\\orderentry\\250
but need line this, in order keep 3rd party app working correctly:
initial dir = \\nas_sl\daten\orderentry\250
an suggestion how can done?
here code:
public static void setexportpath(string exportpath) throws invalidfileformatexception, ioexception{ file f = new file(createfiltmaninipath()); fileinputstream fis = new fileinputstream(f); inputstreamreader isr = new inputstreamreader(fis, "utf-16"); bufferedreader br = new bufferedreader(isr); string firstline = br.readline(); // save first line, has magic-number + non java comment in ini ini = new ini(); ini.load(br); ini.put("mainexportfile", "initial dir", exportpath); fileoutputstream fos = new fileoutputstream(f); outputstreamwriter osw = new outputstreamwriter(fos, "utf-16"); osw.append(firstline); // append @ first saved first line osw.append("\n\n"); ini.store(osw); osw.close(); br.close(); osw.close(); fos.close(); }
Comments
Post a Comment