You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2006/09/01 01:26:12 UTC
svn commit: r439099 -
/geronimo/server/trunk/testsupport/testsupport-common/src/main/java/org/apache/geronimo/testsupport/TestSupport.java
Author: jdillon
Date: Thu Aug 31 16:26:12 2006
New Revision: 439099
URL: http://svn.apache.org/viewvc?rev=439099&view=rev
Log:
Adding resolveFile() and resolvePath() helpers
Modified:
geronimo/server/trunk/testsupport/testsupport-common/src/main/java/org/apache/geronimo/testsupport/TestSupport.java
Modified: geronimo/server/trunk/testsupport/testsupport-common/src/main/java/org/apache/geronimo/testsupport/TestSupport.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsupport/testsupport-common/src/main/java/org/apache/geronimo/testsupport/TestSupport.java?rev=439099&r1=439098&r2=439099&view=diff
==============================================================================
--- geronimo/server/trunk/testsupport/testsupport-common/src/main/java/org/apache/geronimo/testsupport/TestSupport.java (original)
+++ geronimo/server/trunk/testsupport/testsupport-common/src/main/java/org/apache/geronimo/testsupport/TestSupport.java Thu Aug 31 16:26:12 2006
@@ -106,4 +106,40 @@
return dir;
}
+
+ /**
+ * Resolve the given path to a file rooted to {@link #BASEDIR}.
+ *
+ * @param path The path to resolve.
+ * @return The resolved file for the given path.
+ */
+ protected final File resolveFile(final String path) {
+ assert path != null;
+
+ File file = new File(path);
+
+ // Complain if the file is already absolute... probably an error
+ if (file.isAbsolute()) {
+ log.warn("Given path is already absolute; nothing to resolve: " + file);
+ }
+ else {
+ file = new File(BASEDIR, path);
+ }
+
+ return file;
+ }
+
+ /**
+ * Resolve the given path to a path rooted to {@link #BASEDIR}.
+ *
+ * @param path The path to resolve.
+ * @return The resolved path for the given path.
+ *
+ * @see #resolveFile(String)
+ */
+ protected final String resolvePath(final String path) {
+ assert path != null;
+
+ return resolveFile(path).getPath();
+ }
}