donaldp 01/10/12 18:48:41
Modified: src/main/org/apache/tools/ant/taskdefs PathConvert.java
Log:
PathConvert does not allow NetWare as a targetOS. There was also a problem
with the logic of PathConvert treating everything that did not have a
targetOS=Windows as UNIX, where in this case the Windows assumptions are
actually more correct for NetWare. �(The assumptions are the type of classpath
separator, ";" on Windows and NetWare, and the directory path separator, and
NetWare can deal with either "/", or "\\" equally well).
Patch fixes these issues.
Submitted by: "Jeff Tulley" <[EMAIL PROTECTED]>
Revision Changes Path
1.3 +15 -4
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/PathConvert.java
Index: PathConvert.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/PathConvert.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PathConvert.java 2001/07/04 09:45:41 1.2
+++ PathConvert.java 2001/10/13 01:48:41 1.3
@@ -161,14 +161,19 @@
targetOS = target.toLowerCase();
- if( ! targetOS.equals( "windows" ) && ! target.equals( "unix" ) ) {
- throw new BuildException( "targetos must be one of 'unix' or
'windows'" );
+ if( ! targetOS.equals( "windows" ) && ! target.equals( "unix" ) &&
+ ! targetOS.equals( "netware" )) {
+ throw new BuildException( "targetos must be one of 'unix',
'netware', or 'windows'" );
}
// Currently, we deal with only two path formats: Unix and Windows
// And Unix is everything that is not Windows
- targetWindows = targetOS.equals("windows");
+ // for NetWare, piggy-back on Windows, since in the validateSetup
code,
+ // the same assumptions can be made as with windows -
+ // that ; is the path separator
+
+ targetWindows = (targetOS.equals("windows") ||
targetOS.equals("netware"));
}
/**
@@ -235,9 +240,15 @@
// Currently, we deal with only two path formats: Unix and Windows
// And Unix is everything that is not Windows
+ // (with the exception for NetWare below)
String osname = System.getProperty("os.name").toLowerCase();
- onWindows = ( osname.indexOf("windows") >= 0 );
+
+ // for NetWare, piggy-back on Windows, since here and in the
+ // apply code, the same assumptions can be made as with windows -
+ // that \\ is an OK separator, and do comparisons case-insensitive.
+ onWindows = ( (osname.indexOf("windows") >= 0) ||
+ (osname.indexOf("netware") >= 0) );
// Determine the from/to char mappings for dir sep
char fromDirSep = onWindows ? '\\' : '/';