You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by he...@apache.org on 2006/03/05 20:40:58 UTC

svn commit: r383379 - in /jakarta/velocity/engine/trunk: build/build.properties build/build.xml src/test/org/apache/velocity/test/BaseTestCase.java

Author: henning
Date: Sun Mar  5 11:40:57 2006
New Revision: 383379

URL: http://svn.apache.org/viewcvs?rev=383379&view=rev
Log:
Ah well, and then there is Windows where "absolute" and "relative" file names are quite... different. :-) Fix up the getFileName code to work under Windows with an absolute base path.

Modified:
    jakarta/velocity/engine/trunk/build/build.properties
    jakarta/velocity/engine/trunk/build/build.xml
    jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/BaseTestCase.java

Modified: jakarta/velocity/engine/trunk/build/build.properties
URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/build/build.properties?rev=383379&r1=383378&r2=383379&view=diff
==============================================================================
--- jakarta/velocity/engine/trunk/build/build.properties (original)
+++ jakarta/velocity/engine/trunk/build/build.properties Sun Mar  5 11:40:57 2006
@@ -22,11 +22,6 @@
 version=    1.5-dev
 final.name= ${project}-${version}
 
-# This is the relative base dir. This must be the root of the
-# Velocity distribution. All relative pathes are prefixed with
-# velocity.dir
-velocity.dir= ${basedir}
-
 # compile switches
 debug= on
 optimize= on
@@ -67,7 +62,7 @@
 
 # Running the tests
 test.haltonerror= true
-test.haltonfailure= false
+test.haltonfailure= true
 
 # Building the distribution
 dist.root= ${build.dir}/dist

Modified: jakarta/velocity/engine/trunk/build/build.xml
URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/build/build.xml?rev=383379&r1=383378&r2=383379&view=diff
==============================================================================
--- jakarta/velocity/engine/trunk/build/build.xml (original)
+++ jakarta/velocity/engine/trunk/build/build.xml Sun Mar  5 11:40:57 2006
@@ -27,6 +27,14 @@
 
 <project name="Velocity" default="world" basedir="..">
 
+  <path id="basedir-os">
+    <pathelement location="${basedir}" />
+  </path>
+  <!-- This is the relative base dir. This must be the root of the   -->
+  <!-- Velocity distribution. All relative pathes are prefixed with  -->
+  <!-- velocity.dir                                                  -->
+  <pathconvert property="velocity.dir" refid="basedir-os" targetos="unix"/>
+
   <!-- Give user a chance to override without editing this file
        (and without typing -D each time it compiles it -->
   <property file="${user.home}/.ant.properties" />

Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/BaseTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/BaseTestCase.java?rev=383379&r1=383378&r2=383379&view=diff
==============================================================================
--- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/BaseTestCase.java (original)
+++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/BaseTestCase.java Sun Mar  5 11:40:57 2006
@@ -17,6 +17,7 @@
  */
 
 import java.io.File;
+import java.io.IOException;
 
 import junit.framework.TestCase;
 
@@ -57,14 +58,35 @@
     {
         StringBuffer buf = new StringBuffer();
         
-        if (base != null && base.charAt(0) != '/')
+        File baseFile = new File(base);
+
+        if (dir != null)
         {
-            if (dir != null)
+            if (!baseFile.isAbsolute())
+            {
+                baseFile = new File(dir, base);
+
+                try
+                {
+                    buf.append(baseFile.getCanonicalPath());
+                }
+                catch (IOException e)
+                {
+                    fail("IO Exception while getting canonical path for " + baseFile);
+                }
+            }
+            else
             {
-                buf.append(dir).append('/');
+                buf.append(base);
             }
         }
-        buf.append(base).append('.').append(ext);
+        else
+        {
+            buf.append(base);
+        }
+
+        buf.append('.').append(ext);
+
         return buf.toString();
     }
 



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