java - File path problems in windows environment -


i have following line of code:

"%s/ramp_adapter/user_%d/ramp_file_receipt/%d".format(new java.io.file(".").getabsolutepath().replace("/.",""), endpointid, fileid) 

if print line in window wrong file path:

e:\git\project\codeadapters\rampadapter\./ramp_adapter/user_1001/ramp_file_receipt/3 

in unix, file path coming correct.

i know need make compatible windows , tried using filenameutils didn't resolved problem.

the path should correct in environments.

replace

"%s/ramp_adapter/user_%d/ramp_file_receipt/%d" 

with

"%s" + file.separatorchar + "ramp_adapter" + file.separatorchar + "user_%d" + file.separatorchar + "ramp_file_receipt" + file.separatorchar + "%d" 

replace

getabsolutepath().replace("/.","") 

with

getabsolutepath().replace(file.separator + ".", "") 

Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -