You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@hyperreal.org on 1999/11/13 00:33:15 UTC
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util FileUtil.java
costin 99/11/12 15:33:12
Modified: src/share/org/apache/tomcat/util FileUtil.java
Log:
Fix for Windows path problems, thanks rubys@us.ibm.com
Submitted by: rubys@us.ibm.com
Revision Changes Path
1.2 +14 -4 jakarta-tomcat/src/share/org/apache/tomcat/util/FileUtil.java
Index: FileUtil.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/FileUtil.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FileUtil.java 1999/11/08 03:59:52 1.1
+++ FileUtil.java 1999/11/12 23:33:03 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/FileUtil.java,v 1.1 1999/11/08 03:59:52 akv Exp $
- * $Revision: 1.1 $
- * $Date: 1999/11/08 03:59:52 $
+ * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/FileUtil.java,v 1.2 1999/11/12 23:33:03 costin Exp $
+ * $Revision: 1.2 $
+ * $Date: 1999/11/12 23:33:03 $
*
* ====================================================================
*
@@ -97,7 +97,17 @@
public static String patch(String path) {
String patchPath = path.trim();
- if (patchPath.length() >= 2 &&
+
+ // Move drive spec to the front of the path
+ if (patchPath.length() >= 3 &&
+ patchPath.charAt(0) == '/' &&
+ Character.isLetter(patchPath.charAt(1)) &&
+ patchPath.charAt(2) == ':') {
+ patchPath=patchPath.substring(1,3)+"/"+patchPath.substring(3);
+ }
+
+ // Eliminate consecutive slashes after the drive spec
+ if (patchPath.length() >= 2 &&
Character.isLetter(patchPath.charAt(0)) &&
patchPath.charAt(1) == ':') {
char[] ca = patchPath.replace('/', '\\').toCharArray();