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.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@682652 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jacques Le Roux
2008-08-05 09:36:52 +00:00
parent a39b088974
commit bfc0ea779c
@@ -46,12 +46,24 @@ public class FileUtil {
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 {