java - Configure path for win and linux -



java - Configure path for win and linux -

a standalone application windows , linux environment

while utilize windows environment file scheme c:\file\abc\xyz\sample.txt in linux environment file scheme /home/qa/file/abc/xyz/sample.txt

abc , xyz name of folders depends on user click. (abc country code folder) & (xyz language folders)

to build path utilize properties

base_path : /home/test/file/ or c:\test\file\ file_name : sample.txt

in programme construction of path :

string path = base_path+country_code+"/"+language_name+"/"+file_name ("/" linux) string path = base_path+country_code+"\"+language_name+"\"+file_name ( "\" windows)

example linux:

/home/test/file/spain/es/sample.txt

example windows:

c:\test\file\italy\it\sample.txt

country_code , language_name differ each user click.

every time while test application different environment im changing file separator "/" or "\" (windows , linux). how do code without changing file separator every time.

(if missed anything, tell me update same) give thanks u.

you may separator java.io.file.separatorchar (public static final char) or wrapped string java.io.file.separator (public static final string) - "the system-dependent default name-separator character, represented string convenience". see: http://docs.oracle.com/javase/6/docs/api/java/io/file.html#separator

java

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -