Author: jleroux
Date: Tue Aug 5 02:36:52 2008
New Revision: 682652
URL: http://svn.apache.org/viewvc?rev=682652&view=rev
Log:
A patch from Marco Ruocco solving an issue on Windows : File.separator in
Windows system is "\", that is, also, the first character of an escape
sequence. So the replaceAll method expects another char after that.
Modified:
ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/FileUtil.java
Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/FileUtil.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/FileUtil.java?rev=682652&r1=682651&r2=682652&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/FileUtil.java
(original)
+++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/FileUtil.java Tue
Aug 5 02:36:52 2008
@@ -46,12 +46,24 @@
public static final String module = FileUtil.class.getName();
+ public static String escapeSeparator( String separator )
+ {
+ if( "\\".equals( separator ) )
+ {
+ return "\\" + separator;
+ }
+ else
+ {
+ return separator;
+ }
+ }
+
public static File getFile(String path) {
- return new File(path.replaceAll("/+|\\\\+", File.separator));
+ return new File(path.replaceAll("/+|\\\\+",
escapeSeparator(File.separator)));
}
public static File getFile(File root, String path) {
- return new File(root, path.replaceAll("/+|\\\\+", File.separator));
+ return new File(root, path.replaceAll("/+|\\\\+",
escapeSeparator(File.separator)));
}
public static void writeString(String fileName, String s) throws
IOException {