Update of /cvsroot/metamorphosis/ruper2/src/java/core/org/krysalis/ruper/util/io
In directory sc8-pr-cvs1:/tmp/cvs-serv10667/src/java/core/org/krysalis/ruper/util/io
Modified Files:
ResolvedFile.java
Log Message:
1) listSpecifiers ought not work
2) unit tests run again [need to add those to a project]
3) FilenameAnalyzer a bit smarter (copes w/ -alpha better, ala Ben's soln)
4) FileUpdater does something -- kinda/sorta, try it :-)
5) Ant task same...
Index: ResolvedFile.java
===================================================================
RCS file: /cvsroot/metamorphosis/ruper2/src/java/core/org/krysalis/ruper/util/io/ResolvedFile.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ResolvedFile.java 9 Sep 2003 18:37:04 -0000 1.1
--- ResolvedFile.java 12 Sep 2003 20:23:44 -0000 1.2
***************
*** 29,35 ****
return resolve(SystemUtils.getCWD(), file);
}
!
public static File resolve(Object m_resolverContext, Object file) {
!
// Previously resolved within this context...
if ((file instanceof ResolvedFile)
--- 29,35 ----
return resolve(SystemUtils.getCWD(), file);
}
!
public static File resolve(Object m_resolverContext, Object file) {
!
// Previously resolved within this context...
if ((file instanceof ResolvedFile)
***************
*** 46,61 ****
path = (String) file;
else {
! throw new IllegalArgumentException("Unable to resolve " + file.getClass().getName());
}
// Get a fully qualified file
File fullyQualified = null;
! if (m_resolverContext instanceof File)
! fullyQualified = new File((File) m_resolverContext, path);
! else if (m_resolverContext instanceof String)
! fullyQualified =
! new File(new File((String) m_resolverContext), path);
else {
! throw new IllegalArgumentException("Unable to resolve using context " + m_resolverContext.getClass().getName());
}
--- 46,72 ----
path = (String) file;
else {
! throw new IllegalArgumentException(
! "Unable to resolve " + file.getClass().getName());
}
+ File pathFile = new File(path);
+
// Get a fully qualified file
File fullyQualified = null;
! if (pathFile.isAbsolute()) {
! fullyQualified = pathFile;
! }
else {
! if (m_resolverContext instanceof File)
! fullyQualified = new File((File) m_resolverContext, path);
! else if (m_resolverContext instanceof String)
! fullyQualified =
! new File(new File((String) m_resolverContext), path);
! else {
! throw new IllegalArgumentException(
! "Unable to resolve using context "
! + m_resolverContext.getClass().getName());
! }
!
}
***************
*** 63,65 ****
--- 74,95 ----
}
+ public static void main(String args[]) {
+ String file = "lib/test.jar";
+
+ if (args.length > 0)
+ file = args[0];
+
+ File rf1 = ResolvedFile.resolve(file);
+ File rf2 =
+ ResolvedFile.resolve(SystemUtils.getCWD().getAbsolutePath(), file);
+ File rf3 = ResolvedFile.resolve(SystemUtils.getCWD().getAbsolutePath());
+
+ System.out.println("RF1:" + rf1.toString());
+ System.out.println("RF1:" + rf1.getAbsolutePath());
+ System.out.println("RF2:" + rf2.toString());
+ System.out.println("RF2:" + rf2.getAbsolutePath());
+ System.out.println("RF3:" + rf3.toString());
+ System.out.println("RF3:" + rf3.getAbsolutePath());
+
+ }
}
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.