Coldfusion-Java Snippet: Get your Operating System's File Separator.


Coldfusion-Java Snippet: Get your Operating System's File Separator.

Posted by Luis Majano
Sep 27, 2005 00:00:00 UTC
Every wonder a nice, quick and easy way of getting your Operating System's file separator character??

Well, I have several times. Thanks to our collaborator Ariel Gonzalez, and his java expertise. We take a look at the java.lang.System class and its getProperty() Method.

There are several useful properties that you can get from this class, some of them are listed below:


anabelfre

Is there any other way to do it that does not involve createObject?

Luis Majano

You can do a test for windows as the OS, then just do a "" or "/" for non-windows

bkel

Just always use "/" in conjunction with: getCurrentTemplatePath and path = replace(path,"","/","all);

http://corfield.org/blog/index.cfm/do/blog.entry/entry/Backslash_is_NOT_a_path_separator