ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject svn commit: r475206 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/launch/Locator.java src/main/org/apache/tools/ant/util/FileUtils.java src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java
Date Wed, 15 Nov 2006 11:33:44 GMT
Author: antoine
Date: Wed Nov 15 03:33:43 2006
New Revision: 475206

URL: http://svn.apache.org/viewvc?view=rev&rev=475206
Log:
do not uppercase systematically drive letters in FileUtils#normalize
append drive letter to absolute paths in Locator#fromURI
make FileUtilsTest pass under JDK 1.3

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java
    ant/core/trunk/src/main/org/apache/tools/ant/util/FileUtils.java
    ant/core/trunk/src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?view=diff&rev=475206&r1=475205&r2=475206
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Wed Nov 15 03:33:43 2006
@@ -32,6 +32,13 @@
 * add quiet attribute to loadfile/resource.
   Bugzilla 38249.
 
+* make Locator#fromURI also append the drive letter when running under Windows 
+  with JDK 1.3 or 1.2
+
+* do not uppercase the drive letters systematically in FileUtils#normalize
+  
+  
+
 Changes from Ant 1.7.0Beta3 to Ant 1.7.0RC1
 ===========================================
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java?view=diff&rev=475206&r1=475205&r2=475206
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java Wed Nov 15 03:33:43 2006
@@ -207,6 +207,11 @@
         String path = null;
         try {
             path = decodeUri(uri);
+            String cwd = System.getProperty("user.dir");
+            int posi = cwd.indexOf(":");
+            if ((posi > 0) && path.startsWith(File.separator)) {
+               path = cwd.substring(0, posi + 1) + path; 
+            }
         } catch (UnsupportedEncodingException exc) {
             // not sure whether this is clean, but this method is
             // declared not to throw exceptions.

Modified: ant/core/trunk/src/main/org/apache/tools/ant/util/FileUtils.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/FileUtils.java?view=diff&rev=475206&r1=475205&r2=475206
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/util/FileUtils.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/util/FileUtils.java Wed Nov 15 03:33:43 2006
@@ -726,7 +726,7 @@
         if (colon > 0 && (onDos || onNetWare)) {
 
             int next = colon + 1;
-            root = path.substring(0, next).toUpperCase();
+            root = path.substring(0, next);
             char[] ca = path.toCharArray();
             root += sep;
             //remove the initial separator; the root has it.

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java?view=diff&rev=475206&r1=475205&r2=475206
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java Wed Nov 15
03:33:43 2006
@@ -124,9 +124,9 @@
             assertEquals(driveSpec + "\\",
                          FILE_UTILS.resolveFile(null, driveSpec + "\\").getPath());
             String driveSpecLower = "c:";
-            assertEquals(driveSpec + "\\",
+            assertEquals(driveSpecLower + "\\",
                          FILE_UTILS.resolveFile(null, driveSpecLower + "/").getPath());
-            assertEquals(driveSpec + "\\",
+            assertEquals(driveSpecLower + "\\",
                          FILE_UTILS.resolveFile(null, driveSpecLower + "\\").getPath());
             /*
              * promised to eliminate consecutive slashes after drive letter.
@@ -237,9 +237,9 @@
             assertEquals(driveSpec + "\\",
                          FILE_UTILS.normalize(driveSpec + "\\").getPath());
             String driveSpecLower = "c:";
-            assertEquals(driveSpec + "\\",
+            assertEquals(driveSpecLower + "\\",
                          FILE_UTILS.normalize(driveSpecLower + "/").getPath());
-            assertEquals(driveSpec + "\\",
+            assertEquals(driveSpecLower + "\\",
                          FILE_UTILS.normalize(driveSpecLower + "\\").getPath());
             /*
              * promised to eliminate consecutive slashes after drive letter.
@@ -490,6 +490,13 @@
             return "file:/" + uri.substring(prefix.length());
         } else {
             return uri;
+        }
+    }
+
+    public void testIsContextRelativePath() {
+        if (Os.isFamily("dos")) {
+            assertTrue(FileUtils.isContextRelativePath("/\u00E4nt"));
+            assertTrue(FileUtils.isContextRelativePath("\\foo"));
         }
     }
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message