Browse Source

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" <JTULLEY@novell.com>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269784 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 24 years ago
parent
commit
bd699bf0c5
1 changed files with 15 additions and 4 deletions
  1. +15
    -4
      src/main/org/apache/tools/ant/taskdefs/PathConvert.java

+ 15
- 4
src/main/org/apache/tools/ant/taskdefs/PathConvert.java View File

@@ -161,14 +161,19 @@ public class PathConvert extends Task {


targetOS = target.toLowerCase(); 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 // Currently, we deal with only two path formats: Unix and Windows
// And Unix is everything that is not 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 @@ public class PathConvert extends Task {


// Currently, we deal with only two path formats: Unix and Windows // Currently, we deal with only two path formats: Unix and Windows
// And Unix is everything that is not Windows // And Unix is everything that is not Windows
// (with the exception for NetWare below)


String osname = System.getProperty("os.name").toLowerCase(); 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 // Determine the from/to char mappings for dir sep
char fromDirSep = onWindows ? '\\' : '/'; char fromDirSep = onWindows ? '\\' : '/';


Loading…
Cancel
Save