Home
News
Feed
search engine
by
freefind
advanced
tailor filepaths to operating system
2015-07-04
++ tailor filepaths to operating system file separator regular expression linux java windows file path how to make it so that the same java program can handle file paths directories for both windows and linux is there a java utility which will convert a string path to use the correct file http://stackoverflow.com/questions/1697303/is-there-a-java-utility-which-will-convert-a-string-path-to-use-the-correct-file use file.separator or the Path class String rootStorePath = Paths.get("c:/projects/mystuff/").toString(); unless you are using a regular expression, in which case you should use Pattern.quote(File.separator) If you are creating a new file, use file.separator String new_directory_for_new_files = directory+File.separator+"new directory"; ------------ Note that to use file separators in a regular expression that will work in any operating system use Pattern.quote(File.separator) ^ http://stackoverflow.com/questions/242792/escape-path-separator-in-a-regular-expression
azim58wiki: