From bd699bf0c524fd3bcfe7af35a8bc3041254e74f9 Mon Sep 17 00:00:00 2001 From: Peter Donald Date: Sat, 13 Oct 2001 01:48:41 +0000 Subject: [PATCH] =?UTF-8?q?PathConvert=20does=20not=20allow=20NetWare=20as?= =?UTF-8?q?=20a=20targetOS.=20There=20was=20also=20a=20problem=20with=20th?= =?UTF-8?q?e=20logic=20of=20PathConvert=20treating=20everything=20that=20d?= =?UTF-8?q?id=20not=20have=20a=20targetOS=3DWindows=20as=20UNIX,=20where?= =?UTF-8?q?=20in=20this=20case=20the=20Windows=20assumptions=20are=20actua?= =?UTF-8?q?lly=20more=20correct=20for=20NetWare.=20=EF=BF=BD(The=20assumpt?= =?UTF-8?q?ions=20are=20the=20type=20of=20classpath=20separator,=20";"=20o?= =?UTF-8?q?n=20Windows=20and=20NetWare,=20and=20the=20directory=20path=20s?= =?UTF-8?q?eparator,=20and=20NetWare=20can=20deal=20with=20either=20"/",?= =?UTF-8?q?=20or=20"\\"=20equally=20well).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch fixes these issues. Submitted by: "Jeff Tulley" git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269784 13f79535-47bb-0310-9956-ffa450edef68 --- .../tools/ant/taskdefs/PathConvert.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/PathConvert.java b/src/main/org/apache/tools/ant/taskdefs/PathConvert.java index 4a0a3c0a8..0a43df903 100644 --- a/src/main/org/apache/tools/ant/taskdefs/PathConvert.java +++ b/src/main/org/apache/tools/ant/taskdefs/PathConvert.java @@ -161,14 +161,19 @@ public class PathConvert extends Task { 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 @@ public class PathConvert extends Task { // 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 ? '\\' : '/';