* Replaced all usages of Os.isFamily( String ) with Os.isFamily( OsFamily ). * Replaced all usages of "os.name" system properties with calls to Os.isFamily(). git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271667 13f79535-47bb-0310-9956-ffa450edef68master
@@ -72,8 +72,7 @@ public class Exec | |||||
} | } | ||||
/** | /** | ||||
* Only execute the process if <code>os.name</code> is included in this | |||||
* string. | |||||
* Only execute the process if running on the specified OS family. | |||||
*/ | */ | ||||
public void setOs( final String os ) | public void setOs( final String os ) | ||||
{ | { | ||||
@@ -14,6 +14,7 @@ import java.util.Iterator; | |||||
import org.apache.aut.vfs.FileObject; | import org.apache.aut.vfs.FileObject; | ||||
import org.apache.aut.vfs.FileSystemException; | import org.apache.aut.vfs.FileSystemException; | ||||
import org.apache.aut.vfs.FileType; | import org.apache.aut.vfs.FileType; | ||||
import org.apache.aut.vfs.NameScope; | |||||
import org.apache.avalon.excalibur.i18n.ResourceManager; | import org.apache.avalon.excalibur.i18n.ResourceManager; | ||||
import org.apache.avalon.excalibur.i18n.Resources; | import org.apache.avalon.excalibur.i18n.Resources; | ||||
import org.apache.myrmidon.api.AbstractTask; | import org.apache.myrmidon.api.AbstractTask; | ||||
@@ -129,9 +130,10 @@ public class CopyFilesTask | |||||
continue; | continue; | ||||
} | } | ||||
// TODO - use scope here, to make sure that the result | |||||
// is a descendent of the dest dir | |||||
final FileObject destFile = m_destDir.resolveFile( path ); | |||||
// Locate the destination file | |||||
final FileObject destFile = m_destDir.resolveFile( path, NameScope.DESCENDENT ); | |||||
// Copy the file across | |||||
copyFile( srcFile, destFile ); | copyFile( srcFile, destFile ); | ||||
} | } | ||||
} | } | ||||
@@ -7,9 +7,11 @@ | |||||
*/ | */ | ||||
package org.apache.aut.nativelib; | package org.apache.aut.nativelib; | ||||
import java.util.ArrayList; | |||||
import java.util.HashSet; | |||||
import java.util.List; | |||||
import java.util.Locale; | import java.util.Locale; | ||||
import org.apache.avalon.excalibur.i18n.ResourceManager; | |||||
import org.apache.avalon.excalibur.i18n.Resources; | |||||
import java.util.Set; | |||||
/** | /** | ||||
* Class to help determining the OS. | * Class to help determining the OS. | ||||
@@ -20,9 +22,6 @@ import org.apache.avalon.excalibur.i18n.Resources; | |||||
*/ | */ | ||||
public class Os | public class Os | ||||
{ | { | ||||
private final static Resources REZ = | |||||
ResourceManager.getPackageResources( Os.class ); | |||||
private final static String OS_NAME = | private final static String OS_NAME = | ||||
System.getProperty( "os.name" ).toLowerCase( Locale.US ); | System.getProperty( "os.name" ).toLowerCase( Locale.US ); | ||||
private final static String OS_ARCH = | private final static String OS_ARCH = | ||||
@@ -31,6 +30,123 @@ public class Os | |||||
System.getProperty( "os.version" ).toLowerCase( Locale.US ); | System.getProperty( "os.version" ).toLowerCase( Locale.US ); | ||||
private final static String PATH_SEP = | private final static String PATH_SEP = | ||||
System.getProperty( "path.separator" ); | System.getProperty( "path.separator" ); | ||||
private final static OsFamily OS_FAMILY; | |||||
private final static OsFamily[] OS_ALL_FAMILIES; | |||||
/** All Windows based OSes. */ | |||||
public final static OsFamily OS_FAMILY_WINDOWS = new OsFamily( "windows" ); | |||||
/** All DOS based OSes. */ | |||||
public final static OsFamily OS_FAMILY_DOS | |||||
= new OsFamily( "dos", new OsFamily[]{OS_FAMILY_WINDOWS} ); | |||||
/** All Windows NT based OSes. */ | |||||
public final static OsFamily OS_FAMILY_WINNT | |||||
= new OsFamily( "nt", new OsFamily[]{OS_FAMILY_WINDOWS} ); | |||||
/** All Windows 9x based OSes. */ | |||||
public final static OsFamily OS_FAMILY_WIN9X | |||||
= new OsFamily( "win9x", new OsFamily[]{OS_FAMILY_WINDOWS, OS_FAMILY_DOS} ); | |||||
/** OS/2 */ | |||||
public final static OsFamily OS_FAMILY_OS2 | |||||
= new OsFamily( "os/2", new OsFamily[]{OS_FAMILY_DOS} ); | |||||
/** Netware */ | |||||
public final static OsFamily OS_FAMILY_NETWARE | |||||
= new OsFamily( "netware" ); | |||||
/** All UNIX based OSes. */ | |||||
public final static OsFamily OS_FAMILY_UNIX | |||||
= new OsFamily( "unix" ); | |||||
/** All Mac based OSes. */ | |||||
public final static OsFamily OS_FAMILY_MAC | |||||
= new OsFamily( "mac" ); | |||||
/** OSX */ | |||||
public final static OsFamily OS_FAMILY_OSX | |||||
= new OsFamily( "osx", new OsFamily[]{OS_FAMILY_UNIX, OS_FAMILY_MAC} ); | |||||
private final static OsFamily[] ALL_FAMILIES = | |||||
{ | |||||
OS_FAMILY_DOS, | |||||
OS_FAMILY_MAC, | |||||
OS_FAMILY_NETWARE, | |||||
OS_FAMILY_OS2, | |||||
OS_FAMILY_OSX, | |||||
OS_FAMILY_UNIX, | |||||
OS_FAMILY_WINDOWS, | |||||
OS_FAMILY_WINNT, | |||||
OS_FAMILY_WIN9X | |||||
}; | |||||
static | |||||
{ | |||||
// Determine the most specific OS family | |||||
if( OS_NAME.indexOf( "windows" ) > -1 ) | |||||
{ | |||||
if( OS_NAME.indexOf( "xp" ) > -1 | |||||
|| OS_NAME.indexOf( "2000" ) > -1 | |||||
|| OS_NAME.indexOf( "nt" ) > -1 ) | |||||
{ | |||||
OS_FAMILY = OS_FAMILY_WINNT; | |||||
} | |||||
else | |||||
{ | |||||
OS_FAMILY = OS_FAMILY_WIN9X; | |||||
} | |||||
} | |||||
else if( OS_NAME.indexOf( "os/2" ) > -1 ) | |||||
{ | |||||
OS_FAMILY = OS_FAMILY_OS2; | |||||
} | |||||
else if( OS_NAME.indexOf( "netware" ) > -1 ) | |||||
{ | |||||
OS_FAMILY = OS_FAMILY_NETWARE; | |||||
} | |||||
else if( OS_NAME.indexOf( "mac" ) > -1 ) | |||||
{ | |||||
if( OS_NAME.endsWith( "x" ) ) | |||||
{ | |||||
OS_FAMILY = OS_FAMILY_OSX; | |||||
} | |||||
else | |||||
{ | |||||
OS_FAMILY = OS_FAMILY_MAC; | |||||
} | |||||
} | |||||
else if( PATH_SEP.equals( ":" ) ) | |||||
{ | |||||
OS_FAMILY = OS_FAMILY_UNIX; | |||||
} | |||||
else | |||||
{ | |||||
OS_FAMILY = null; | |||||
} | |||||
// Otherwise, unknown OS | |||||
// Determine all families the current OS belongs to | |||||
Set allFamilies = new HashSet(); | |||||
if( OS_FAMILY != null ) | |||||
{ | |||||
List queue = new ArrayList(); | |||||
queue.add( OS_FAMILY ); | |||||
while( queue.size() > 0 ) | |||||
{ | |||||
final OsFamily family = (OsFamily)queue.remove( 0 ); | |||||
allFamilies.add( family ); | |||||
final OsFamily[] families = family.getFamilies(); | |||||
for( int i = 0; i < families.length; i++ ) | |||||
{ | |||||
OsFamily parent = families[ i ]; | |||||
queue.add( parent ); | |||||
} | |||||
} | |||||
} | |||||
OS_ALL_FAMILIES = (OsFamily[])allFamilies.toArray( new OsFamily[ allFamilies.size() ] ); | |||||
} | |||||
/** | /** | ||||
* Private constructor to block instantiation. | * Private constructor to block instantiation. | ||||
@@ -45,34 +161,36 @@ public class Os | |||||
*/ | */ | ||||
public static boolean isVersion( final String version ) | public static boolean isVersion( final String version ) | ||||
{ | { | ||||
return isOs( null, null, null, version ); | |||||
return isOs( (OsFamily)null, null, null, version ); | |||||
} | } | ||||
/** | /** | ||||
* Determines if the OS on which Ant is executing matches the given OS | * Determines if the OS on which Ant is executing matches the given OS | ||||
* architecture. | * architecture. | ||||
* | |||||
* @param arch Description of Parameter | |||||
* @return The Arch value | |||||
*/ | */ | ||||
public static boolean isArch( final String arch ) | public static boolean isArch( final String arch ) | ||||
{ | { | ||||
return isOs( null, null, arch, null ); | |||||
return isOs( (OsFamily)null, null, arch, null ); | |||||
} | } | ||||
/** | /** | ||||
* Determines if the OS on which Ant is executing matches the given OS | * Determines if the OS on which Ant is executing matches the given OS | ||||
* family. | * family. | ||||
* | |||||
* @param family Description of Parameter | |||||
* @return The Family value | |||||
* @since 1.5 | |||||
*/ | */ | ||||
public static boolean isFamily( final String family ) | public static boolean isFamily( final String family ) | ||||
{ | { | ||||
return isOs( family, null, null, null ); | return isOs( family, null, null, null ); | ||||
} | } | ||||
/** | |||||
* Determines if the OS on which Ant is executing matches the given OS | |||||
* family. | |||||
*/ | |||||
public static boolean isFamily( final OsFamily family ) | |||||
{ | |||||
return isOs( family, null, null, null ); | |||||
} | |||||
/** | /** | ||||
* Determines if the OS on which Ant is executing matches the given OS name. | * Determines if the OS on which Ant is executing matches the given OS name. | ||||
* | * | ||||
@@ -82,7 +200,7 @@ public class Os | |||||
*/ | */ | ||||
public static boolean isName( final String name ) | public static boolean isName( final String name ) | ||||
{ | { | ||||
return isOs( null, name, null, null ); | |||||
return isOs( (OsFamily)null, name, null, null ); | |||||
} | } | ||||
/** | /** | ||||
@@ -99,6 +217,24 @@ public class Os | |||||
final String name, | final String name, | ||||
final String arch, | final String arch, | ||||
final String version ) | final String version ) | ||||
{ | |||||
return isOs( getFamily( family ), name, arch, version ); | |||||
} | |||||
/** | |||||
* Determines if the OS on which Ant is executing matches the given OS | |||||
* family, name, architecture and version | |||||
* | |||||
* @param family The OS family | |||||
* @param name The OS name | |||||
* @param arch The OS architecture | |||||
* @param version The OS version | |||||
* @return The Os value | |||||
*/ | |||||
public static boolean isOs( final OsFamily family, | |||||
final String name, | |||||
final String arch, | |||||
final String version ) | |||||
{ | { | ||||
if( family != null || name != null || arch != null || version != null ) | if( family != null || name != null || arch != null || version != null ) | ||||
{ | { | ||||
@@ -115,6 +251,25 @@ public class Os | |||||
} | } | ||||
} | } | ||||
/** | |||||
* Locates an OsFamily by name (case-insensitive). | |||||
* | |||||
* @return the OS family, or null if not found. | |||||
*/ | |||||
public static OsFamily getFamily( final String name ) | |||||
{ | |||||
for( int i = 0; i < ALL_FAMILIES.length; i++ ) | |||||
{ | |||||
final OsFamily osFamily = ALL_FAMILIES[ i ]; | |||||
if( osFamily.getName().equalsIgnoreCase( name ) ) | |||||
{ | |||||
return osFamily; | |||||
} | |||||
} | |||||
return null; | |||||
} | |||||
private static boolean versionMatches( final String version ) | private static boolean versionMatches( final String version ) | ||||
{ | { | ||||
boolean isVersion = true; | boolean isVersion = true; | ||||
@@ -145,42 +300,20 @@ public class Os | |||||
return isName; | return isName; | ||||
} | } | ||||
private static boolean familyMatches( final String family ) | |||||
private static boolean familyMatches( final OsFamily family ) | |||||
{ | { | ||||
boolean isFamily = true; | |||||
if( family != null ) | |||||
if( family == null ) | |||||
{ | { | ||||
if( family.equals( "windows" ) ) | |||||
{ | |||||
isFamily = OS_NAME.indexOf( "windows" ) > -1; | |||||
} | |||||
else if( family.equals( "os/2" ) ) | |||||
{ | |||||
isFamily = OS_NAME.indexOf( "os/2" ) > -1; | |||||
} | |||||
else if( family.equals( "netware" ) ) | |||||
{ | |||||
isFamily = OS_NAME.indexOf( "netware" ) > -1; | |||||
} | |||||
else if( family.equals( "dos" ) ) | |||||
{ | |||||
isFamily = PATH_SEP.equals( ";" ) && !isFamily( "netware" ); | |||||
} | |||||
else if( family.equals( "mac" ) ) | |||||
{ | |||||
isFamily = OS_NAME.indexOf( "mac" ) > -1; | |||||
} | |||||
else if( family.equals( "unix" ) ) | |||||
{ | |||||
isFamily = PATH_SEP.equals( ":" ) && | |||||
( !isFamily( "mac" ) || OS_NAME.endsWith( "x" ) ); | |||||
} | |||||
else | |||||
return false; | |||||
} | |||||
for( int i = 0; i < OS_ALL_FAMILIES.length; i++ ) | |||||
{ | |||||
final OsFamily osFamily = OS_ALL_FAMILIES[ i ]; | |||||
if( family == osFamily ) | |||||
{ | { | ||||
final String message = REZ.getString( "unknown-os-family", family ); | |||||
throw new IllegalArgumentException( message ); | |||||
return true; | |||||
} | } | ||||
} | } | ||||
return isFamily; | |||||
return false; | |||||
} | } | ||||
} | } |
@@ -0,0 +1,48 @@ | |||||
/* | |||||
* Copyright (C) The Apache Software Foundation. All rights reserved. | |||||
* | |||||
* This software is published under the terms of the Apache Software License | |||||
* version 1.1, a copy of which has been included with this distribution in | |||||
* the LICENSE.txt file. | |||||
*/ | |||||
package org.apache.aut.nativelib; | |||||
/** | |||||
* An enumerated type, which represents an OS family. | |||||
* | |||||
* @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a> | |||||
* @version $Revision$ $Date$ | |||||
*/ | |||||
public final class OsFamily | |||||
{ | |||||
private final String m_name; | |||||
private final OsFamily[] m_families; | |||||
OsFamily( final String name ) | |||||
{ | |||||
m_name = name; | |||||
m_families = new OsFamily[0]; | |||||
} | |||||
OsFamily( final String name, final OsFamily[] families ) | |||||
{ | |||||
m_name = name; | |||||
m_families = families; | |||||
} | |||||
/** | |||||
* Returns the name of this family. | |||||
*/ | |||||
public String getName() | |||||
{ | |||||
return m_name; | |||||
} | |||||
/** | |||||
* Returns the OS families that this family belongs to. | |||||
*/ | |||||
public OsFamily[] getFamilies() | |||||
{ | |||||
return m_families; | |||||
} | |||||
} |
@@ -11,7 +11,6 @@ import java.io.File; | |||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.io.InputStream; | import java.io.InputStream; | ||||
import java.io.OutputStream; | import java.io.OutputStream; | ||||
import java.util.Locale; | |||||
import java.util.Properties; | import java.util.Properties; | ||||
import org.apache.aut.nativelib.ExecException; | import org.apache.aut.nativelib.ExecException; | ||||
import org.apache.aut.nativelib.ExecManager; | import org.apache.aut.nativelib.ExecManager; | ||||
@@ -174,37 +173,28 @@ public class DefaultExecManager | |||||
{ | { | ||||
CommandLauncher launcher = null; | CommandLauncher launcher = null; | ||||
if( Os.isFamily( "mac" ) ) | |||||
if( Os.isFamily( Os.OS_FAMILY_MAC ) ) | |||||
{ | { | ||||
// Mac | // Mac | ||||
launcher = new MacCommandLauncher(); | launcher = new MacCommandLauncher(); | ||||
} | } | ||||
else if( Os.isFamily( "os/2" ) ) | |||||
else if( Os.isFamily( Os.OS_FAMILY_OS2 ) ) | |||||
{ | { | ||||
// OS/2 - use same mechanism as Windows 2000 | // OS/2 - use same mechanism as Windows 2000 | ||||
launcher = new WinNTCommandLauncher(); | launcher = new WinNTCommandLauncher(); | ||||
} | } | ||||
else if( Os.isFamily( "windows" ) ) | |||||
else if( Os.isFamily( Os.OS_FAMILY_WINNT ) ) | |||||
{ | { | ||||
// Windows. Need to determine which JDK we're running in | |||||
// Determine if we're running under 2000/NT or 98/95 | |||||
final String osname = | |||||
System.getProperty( "os.name" ).toLowerCase( Locale.US ); | |||||
if( osname.indexOf( "nt" ) >= 0 || osname.indexOf( "2000" ) >= 0 ) | |||||
{ | |||||
// Windows 2000/NT | |||||
launcher = new WinNTCommandLauncher(); | |||||
} | |||||
else | |||||
{ | |||||
// Windows 98/95 - need to use an auxiliary script | |||||
final String script = resolveCommand( homeDir, "bin/antRun.bat" ); | |||||
launcher = new ScriptCommandLauncher( script ); | |||||
} | |||||
// Windows 2000/NT | |||||
launcher = new WinNTCommandLauncher(); | |||||
} | |||||
else if( Os.isFamily( Os.OS_FAMILY_WINDOWS ) ) | |||||
{ | |||||
// Windows 98/95 - need to use an auxiliary script | |||||
final String script = resolveCommand( homeDir, "bin/antRun.bat" ); | |||||
launcher = new ScriptCommandLauncher( script ); | |||||
} | } | ||||
else if( Os.isFamily( "netware" ) ) | |||||
else if( Os.isFamily( Os.OS_FAMILY_NETWARE ) ) | |||||
{ | { | ||||
// NetWare. Need to determine which JDK we're running in | // NetWare. Need to determine which JDK we're running in | ||||
final String perlScript = resolveCommand( homeDir, "bin/antRun.pl" ); | final String perlScript = resolveCommand( homeDir, "bin/antRun.pl" ); | ||||
@@ -12,14 +12,13 @@ import java.io.ByteArrayOutputStream; | |||||
import java.io.File; | import java.io.File; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.io.StringReader; | import java.io.StringReader; | ||||
import java.util.Locale; | |||||
import java.util.Properties; | import java.util.Properties; | ||||
import org.apache.aut.nativelib.ExecException; | import org.apache.aut.nativelib.ExecException; | ||||
import org.apache.aut.nativelib.ExecManager; | import org.apache.aut.nativelib.ExecManager; | ||||
import org.apache.aut.nativelib.ExecMetaData; | import org.apache.aut.nativelib.ExecMetaData; | ||||
import org.apache.aut.nativelib.Os; | import org.apache.aut.nativelib.Os; | ||||
import org.apache.avalon.excalibur.util.StringUtil; | |||||
import org.apache.avalon.excalibur.io.IOUtil; | import org.apache.avalon.excalibur.io.IOUtil; | ||||
import org.apache.avalon.excalibur.util.StringUtil; | |||||
/** | /** | ||||
* This is the class that can be used to retrieve the environment | * This is the class that can be used to retrieve the environment | ||||
@@ -178,33 +177,27 @@ final class Environment | |||||
private static String[] getEnvCommand() | private static String[] getEnvCommand() | ||||
throws ExecException | throws ExecException | ||||
{ | { | ||||
if( Os.isFamily( "os/2" ) ) | |||||
if( Os.isFamily( Os.OS_FAMILY_OS2 ) ) | |||||
{ | { | ||||
// OS/2 - use same mechanism as Windows 2000 | // OS/2 - use same mechanism as Windows 2000 | ||||
return CMD_EXE; | return CMD_EXE; | ||||
} | } | ||||
else if( Os.isFamily( "windows" ) ) | |||||
else if( Os.isFamily( Os.OS_FAMILY_WINNT ) ) | |||||
{ | { | ||||
final String osname = | |||||
System.getProperty( "os.name" ).toLowerCase( Locale.US ); | |||||
// Determine if we're running under 2000/NT or 98/95 | |||||
if( osname.indexOf( "nt" ) >= 0 || osname.indexOf( "2000" ) >= 0 ) | |||||
{ | |||||
// Windows 2000/NT | |||||
return CMD_EXE; | |||||
} | |||||
else | |||||
{ | |||||
// Windows 98/95 - need to use an auxiliary script | |||||
return COMMAND_COM; | |||||
} | |||||
// Windows 2000/NT | |||||
return CMD_EXE; | |||||
} | |||||
else if( Os.isFamily( Os.OS_FAMILY_WINDOWS) ) | |||||
{ | |||||
// Windows 98/95 - need to use an auxiliary script | |||||
return COMMAND_COM; | |||||
} | } | ||||
else if( Os.isFamily( "unix" ) ) | |||||
else if( Os.isFamily( Os.OS_FAMILY_UNIX ) ) | |||||
{ | { | ||||
// Generic UNIX | // Generic UNIX | ||||
return ENV_CMD; | return ENV_CMD; | ||||
} | } | ||||
else if( Os.isFamily( "netware" ) ) | |||||
else if( Os.isFamily( Os.OS_FAMILY_NETWARE ) ) | |||||
{ | { | ||||
return ENV_RAW; | return ENV_RAW; | ||||
} | } | ||||
@@ -9,6 +9,7 @@ package org.apache.aut.tar; | |||||
import java.io.File; | import java.io.File; | ||||
import java.util.Date; | import java.util.Date; | ||||
import org.apache.aut.nativelib.Os; | |||||
/** | /** | ||||
* This class represents an entry in a Tar archive. It consists of the entry's | * This class represents an entry in a Tar archive. It consists of the entry's | ||||
@@ -178,37 +179,29 @@ public class TarEntry | |||||
m_file = file; | m_file = file; | ||||
String name = file.getPath(); | String name = file.getPath(); | ||||
final String osname = System.getProperty( "os.name" ); | |||||
if( osname != null ) | |||||
// Strip off drive letters! | |||||
if( Os.isFamily( Os.OS_FAMILY_WINDOWS) ) | |||||
{ | { | ||||
// Strip off drive letters! | |||||
// REVIEW Would a better check be "(File.separator == '\')"? | |||||
final String win32Prefix = "Windows"; | |||||
final String prefix = osname.substring( 0, win32Prefix.length() ); | |||||
if( prefix.equalsIgnoreCase( win32Prefix ) ) | |||||
if( name.length() > 2 ) | |||||
{ | { | ||||
if( name.length() > 2 ) | |||||
final char ch1 = name.charAt( 0 ); | |||||
final char ch2 = name.charAt( 1 ); | |||||
if( ch2 == ':' && | |||||
( ( ch1 >= 'a' && ch1 <= 'z' ) || | |||||
( ch1 >= 'A' && ch1 <= 'Z' ) ) ) | |||||
{ | { | ||||
final char ch1 = name.charAt( 0 ); | |||||
final char ch2 = name.charAt( 1 ); | |||||
if( ch2 == ':' && | |||||
( ( ch1 >= 'a' && ch1 <= 'z' ) || | |||||
( ch1 >= 'A' && ch1 <= 'Z' ) ) ) | |||||
{ | |||||
name = name.substring( 2 ); | |||||
} | |||||
name = name.substring( 2 ); | |||||
} | } | ||||
} | } | ||||
else if( osname.toLowerCase().indexOf( "netware" ) > -1 ) | |||||
} | |||||
else if( Os.isFamily( Os.OS_FAMILY_NETWARE) ) | |||||
{ | |||||
final int colon = name.indexOf( ':' ); | |||||
if( colon != -1 ) | |||||
{ | { | ||||
final int colon = name.indexOf( ':' ); | |||||
if( colon != -1 ) | |||||
{ | |||||
name = name.substring( colon + 1 ); | |||||
} | |||||
name = name.substring( colon + 1 ); | |||||
} | } | ||||
} | } | ||||
@@ -584,7 +577,7 @@ public class TarEntry | |||||
/** | /** | ||||
* Write an entry's header information to a header buffer. | * Write an entry's header information to a header buffer. | ||||
* | * | ||||
* @param outbuf The tar entry header buffer to fill in. | |||||
* @param buffer The tar entry header buffer to fill in. | |||||
*/ | */ | ||||
public void writeEntryHeader( final byte[] buffer ) | public void writeEntryHeader( final byte[] buffer ) | ||||
{ | { | ||||
@@ -141,7 +141,7 @@ public class DependSet extends MatchingTask | |||||
* be able to check file modification times. | * be able to check file modification times. | ||||
* (Windows has a max resolution of two secs for modification times) | * (Windows has a max resolution of two secs for modification times) | ||||
*/ | */ | ||||
if( Os.isFamily( "windows" ) ) | |||||
if( Os.isFamily( Os.OS_FAMILY_WINDOWS ) ) | |||||
{ | { | ||||
now += 2000; | now += 2000; | ||||
} | } | ||||
@@ -12,7 +12,6 @@ import java.util.ArrayList; | |||||
import java.util.Iterator; | import java.util.Iterator; | ||||
import org.apache.aut.nativelib.Os; | import org.apache.aut.nativelib.Os; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.myrmidon.api.AbstractTask; | |||||
import org.apache.myrmidon.framework.JavaVersion; | import org.apache.myrmidon.framework.JavaVersion; | ||||
import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter; | import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter; | ||||
import org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory; | import org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory; | ||||
@@ -726,7 +725,7 @@ public class Javac extends MatchingTask | |||||
{ | { | ||||
// This is the most common extension case - exe for windows and OS/2, | // This is the most common extension case - exe for windows and OS/2, | ||||
// nothing for *nix. | // nothing for *nix. | ||||
String extension = Os.isFamily( "dos" ) ? ".exe" : ""; | |||||
String extension = Os.isFamily( Os.OS_FAMILY_DOS ) ? ".exe" : ""; | |||||
// Look for java in the java.home/../bin directory. Unfortunately | // Look for java in the java.home/../bin directory. Unfortunately | ||||
// on Windows java.home doesn't always refer to the correct location, | // on Windows java.home doesn't always refer to the correct location, | ||||
@@ -736,7 +735,7 @@ public class Javac extends MatchingTask | |||||
new java.io.File( System.getProperty( "java.home" ) + | new java.io.File( System.getProperty( "java.home" ) + | ||||
"/../bin/javac" + extension ); | "/../bin/javac" + extension ); | ||||
if( jExecutable.exists() && !Os.isFamily( "netware" ) ) | |||||
if( jExecutable.exists() && !Os.isFamily( Os.OS_FAMILY_NETWARE ) ) | |||||
{ | { | ||||
return jExecutable.getAbsolutePath(); | return jExecutable.getAbsolutePath(); | ||||
} | } | ||||
@@ -9,6 +9,7 @@ package org.apache.tools.ant.taskdefs; | |||||
import java.io.File; | import java.io.File; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import org.apache.aut.nativelib.Os; | |||||
import org.apache.myrmidon.api.AbstractTask; | import org.apache.myrmidon.api.AbstractTask; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
@@ -45,7 +46,7 @@ public class PathConvert extends AbstractTask | |||||
/** | /** | ||||
* Override the default path separator string for the target os | * Override the default path separator string for the target os | ||||
* | * | ||||
* @param sep The new PathSep value | |||||
* @param pathSep The new PathSep value | |||||
*/ | */ | ||||
public void setPathSep( final String pathSep ) | public void setPathSep( final String pathSep ) | ||||
{ | { | ||||
@@ -64,7 +65,7 @@ public class PathConvert extends AbstractTask | |||||
/** | /** | ||||
* Set the value of the targetos attribute | * Set the value of the targetos attribute | ||||
* | * | ||||
* @param target The new Targetos value | |||||
* @param targetOS The new Targetos value | |||||
*/ | */ | ||||
public void setTargetos( String targetOS ) | public void setTargetos( String targetOS ) | ||||
throws TaskException | throws TaskException | ||||
@@ -121,13 +122,10 @@ public class PathConvert extends AbstractTask | |||||
// And Unix is everything that is not Windows | // And Unix is everything that is not Windows | ||||
// (with the exception for NetWare below) | // (with the exception for NetWare below) | ||||
String osname = System.getProperty( "os.name" ).toLowerCase(); | |||||
// for NetWare, piggy-back on Windows, since here and in the | // for NetWare, piggy-back on Windows, since here and in the | ||||
// apply code, the same assumptions can be made as with windows - | // apply code, the same assumptions can be made as with windows - | ||||
// that \\ is an OK separator, and do comparisons case-insensitive. | // that \\ is an OK separator, and do comparisons case-insensitive. | ||||
m_onWindows = ( ( osname.indexOf( "windows" ) >= 0 ) || | |||||
( osname.indexOf( "netware" ) >= 0 ) ); | |||||
m_onWindows = ( Os.isFamily( Os.OS_FAMILY_WINDOWS ) || Os.isFamily( Os.OS_FAMILY_NETWARE ) ); | |||||
// Determine the from/to char mappings for dir sep | // Determine the from/to char mappings for dir sep | ||||
char fromDirSep = m_onWindows ? '\\' : '/'; | char fromDirSep = m_onWindows ? '\\' : '/'; | ||||
@@ -845,7 +845,7 @@ public class Javadoc | |||||
{ | { | ||||
// This is the most common extension case - exe for windows and OS/2, | // This is the most common extension case - exe for windows and OS/2, | ||||
// nothing for *nix. | // nothing for *nix. | ||||
String extension = Os.isFamily( "dos" ) ? ".exe" : ""; | |||||
String extension = Os.isFamily( Os.OS_FAMILY_DOS ) ? ".exe" : ""; | |||||
// Look for javadoc in the java.home/../bin directory. Unfortunately | // Look for javadoc in the java.home/../bin directory. Unfortunately | ||||
// on Windows java.home doesn't always refer to the correct location, | // on Windows java.home doesn't always refer to the correct location, | ||||
@@ -854,17 +854,12 @@ public class Javadoc | |||||
File jdocExecutable = new File( System.getProperty( "java.home" ) + | File jdocExecutable = new File( System.getProperty( "java.home" ) + | ||||
"/../bin/javadoc" + extension ); | "/../bin/javadoc" + extension ); | ||||
if( jdocExecutable.exists() && !Os.isFamily( "netware" ) ) | |||||
if( jdocExecutable.exists() && !Os.isFamily( Os.OS_FAMILY_NETWARE ) ) | |||||
{ | { | ||||
return jdocExecutable.getAbsolutePath(); | return jdocExecutable.getAbsolutePath(); | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
if( !Os.isFamily( "netware" ) ) | |||||
{ | |||||
getLogger().debug( "Unable to locate " + jdocExecutable.getAbsolutePath() + | |||||
". Using \"javadoc\" instead." ); | |||||
} | |||||
return "javadoc"; | return "javadoc"; | ||||
} | } | ||||
} | } | ||||
@@ -17,8 +17,8 @@ import java.util.Iterator; | |||||
import org.apache.aut.nativelib.ExecManager; | import org.apache.aut.nativelib.ExecManager; | ||||
import org.apache.aut.nativelib.Os; | import org.apache.aut.nativelib.Os; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.tools.ant.taskdefs.MatchingTask; | |||||
import org.apache.myrmidon.framework.Execute; | import org.apache.myrmidon.framework.Execute; | ||||
import org.apache.tools.ant.taskdefs.MatchingTask; | |||||
import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
import org.apache.tools.ant.types.DirectoryScanner; | import org.apache.tools.ant.types.DirectoryScanner; | ||||
import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
@@ -103,7 +103,7 @@ public class Cab | |||||
getLogger().info( "Building cab: " + m_cabFile.getAbsolutePath() ); | getLogger().info( "Building cab: " + m_cabFile.getAbsolutePath() ); | ||||
if( !Os.isFamily( "windows" ) ) | |||||
if( !Os.isFamily( Os.OS_FAMILY_WINDOWS ) ) | |||||
{ | { | ||||
getLogger().debug( "Using listcab/libcabinet" ); | getLogger().debug( "Using listcab/libcabinet" ); | ||||
@@ -21,6 +21,7 @@ import java.io.Reader; | |||||
import java.io.Writer; | import java.io.Writer; | ||||
import java.util.Iterator; | import java.util.Iterator; | ||||
import java.util.NoSuchElementException; | import java.util.NoSuchElementException; | ||||
import org.apache.aut.nativelib.Os; | |||||
import org.apache.avalon.excalibur.io.FileUtil; | import org.apache.avalon.excalibur.io.FileUtil; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.tools.ant.taskdefs.MatchingTask; | import org.apache.tools.ant.taskdefs.MatchingTask; | ||||
@@ -122,25 +123,23 @@ public class FixCRLF | |||||
public FixCRLF() | public FixCRLF() | ||||
{ | { | ||||
tabs = ASIS; | tabs = ASIS; | ||||
if( File.pathSeparator.equals( ":" ) ) | |||||
if( Os.isFamily( Os.OS_FAMILY_WINDOWS) ) | |||||
{ | |||||
ctrlz = ASIS; | |||||
eol = CRLF; | |||||
eolstr = "\r\n"; | |||||
} | |||||
else if( Os.isFamily( Os.OS_FAMILY_MAC ) ) | |||||
{ | { | ||||
ctrlz = REMOVE; | ctrlz = REMOVE; | ||||
if( System.getProperty( "os.name" ).indexOf( "Mac" ) > -1 ) | |||||
{ | |||||
eol = CR; | |||||
eolstr = "\r"; | |||||
} | |||||
else | |||||
{ | |||||
eol = LF; | |||||
eolstr = "\n"; | |||||
} | |||||
eol = CR; | |||||
eolstr = "\r"; | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
ctrlz = ASIS; | |||||
eol = CRLF; | |||||
eolstr = "\r\n"; | |||||
ctrlz = REMOVE; | |||||
eol = LF; | |||||
eolstr = "\n"; | |||||
} | } | ||||
} | } | ||||
@@ -618,9 +617,7 @@ public class FixCRLF | |||||
} | } | ||||
else | else | ||||
{// (tabs != ASIS) | {// (tabs != ASIS) | ||||
int ptr; | |||||
while( ( ptr = line.getNext() ) < linelen ) | |||||
while( line.getNext() < linelen ) | |||||
{ | { | ||||
switch( lines.getState() ) | switch( lines.getState() ) | ||||
@@ -264,7 +264,7 @@ public class CommandlineJava | |||||
{ | { | ||||
// This is the most common extension case - exe for windows and OS/2, | // This is the most common extension case - exe for windows and OS/2, | ||||
// nothing for *nix. | // nothing for *nix. | ||||
String extension = Os.isFamily( "dos" ) ? ".exe" : ""; | |||||
String extension = Os.isFamily( Os.OS_FAMILY_DOS ) ? ".exe" : ""; | |||||
// Look for java in the java.home/../bin directory. Unfortunately | // Look for java in the java.home/../bin directory. Unfortunately | ||||
// on Windows java.home doesn't always refer to the correct location, | // on Windows java.home doesn't always refer to the correct location, | ||||
@@ -274,7 +274,7 @@ public class CommandlineJava | |||||
new File( System.getProperty( "java.home" ) + | new File( System.getProperty( "java.home" ) + | ||||
"/../bin/java" + extension ); | "/../bin/java" + extension ); | ||||
if( jExecutable.exists() && !Os.isFamily( "netware" ) ) | |||||
if( jExecutable.exists() && !Os.isFamily( Os.OS_FAMILY_NETWARE ) ) | |||||
{ | { | ||||
// NetWare may have a "java" in that directory, but 99% of | // NetWare may have a "java" in that directory, but 99% of | ||||
// the time, you don't want to execute it -- Jeff Tulley | // the time, you don't want to execute it -- Jeff Tulley | ||||
@@ -56,7 +56,7 @@ public class SourceFileScanner | |||||
* not have it, so if we could reliably passively test for an NTFS | * not have it, so if we could reliably passively test for an NTFS | ||||
* file systems we could turn this off... | * file systems we could turn this off... | ||||
*/ | */ | ||||
if( Os.isFamily( "windows" ) ) | |||||
if( Os.isFamily( Os.OS_FAMILY_WINDOWS ) ) | |||||
{ | { | ||||
now += 2000; | now += 2000; | ||||
} | } | ||||
@@ -141,7 +141,7 @@ public class DependSet extends MatchingTask | |||||
* be able to check file modification times. | * be able to check file modification times. | ||||
* (Windows has a max resolution of two secs for modification times) | * (Windows has a max resolution of two secs for modification times) | ||||
*/ | */ | ||||
if( Os.isFamily( "windows" ) ) | |||||
if( Os.isFamily( Os.OS_FAMILY_WINDOWS ) ) | |||||
{ | { | ||||
now += 2000; | now += 2000; | ||||
} | } | ||||
@@ -12,7 +12,6 @@ import java.util.ArrayList; | |||||
import java.util.Iterator; | import java.util.Iterator; | ||||
import org.apache.aut.nativelib.Os; | import org.apache.aut.nativelib.Os; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.myrmidon.api.AbstractTask; | |||||
import org.apache.myrmidon.framework.JavaVersion; | import org.apache.myrmidon.framework.JavaVersion; | ||||
import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter; | import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter; | ||||
import org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory; | import org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory; | ||||
@@ -726,7 +725,7 @@ public class Javac extends MatchingTask | |||||
{ | { | ||||
// This is the most common extension case - exe for windows and OS/2, | // This is the most common extension case - exe for windows and OS/2, | ||||
// nothing for *nix. | // nothing for *nix. | ||||
String extension = Os.isFamily( "dos" ) ? ".exe" : ""; | |||||
String extension = Os.isFamily( Os.OS_FAMILY_DOS ) ? ".exe" : ""; | |||||
// Look for java in the java.home/../bin directory. Unfortunately | // Look for java in the java.home/../bin directory. Unfortunately | ||||
// on Windows java.home doesn't always refer to the correct location, | // on Windows java.home doesn't always refer to the correct location, | ||||
@@ -736,7 +735,7 @@ public class Javac extends MatchingTask | |||||
new java.io.File( System.getProperty( "java.home" ) + | new java.io.File( System.getProperty( "java.home" ) + | ||||
"/../bin/javac" + extension ); | "/../bin/javac" + extension ); | ||||
if( jExecutable.exists() && !Os.isFamily( "netware" ) ) | |||||
if( jExecutable.exists() && !Os.isFamily( Os.OS_FAMILY_NETWARE ) ) | |||||
{ | { | ||||
return jExecutable.getAbsolutePath(); | return jExecutable.getAbsolutePath(); | ||||
} | } | ||||
@@ -9,6 +9,7 @@ package org.apache.tools.ant.taskdefs; | |||||
import java.io.File; | import java.io.File; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import org.apache.aut.nativelib.Os; | |||||
import org.apache.myrmidon.api.AbstractTask; | import org.apache.myrmidon.api.AbstractTask; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
@@ -45,7 +46,7 @@ public class PathConvert extends AbstractTask | |||||
/** | /** | ||||
* Override the default path separator string for the target os | * Override the default path separator string for the target os | ||||
* | * | ||||
* @param sep The new PathSep value | |||||
* @param pathSep The new PathSep value | |||||
*/ | */ | ||||
public void setPathSep( final String pathSep ) | public void setPathSep( final String pathSep ) | ||||
{ | { | ||||
@@ -64,7 +65,7 @@ public class PathConvert extends AbstractTask | |||||
/** | /** | ||||
* Set the value of the targetos attribute | * Set the value of the targetos attribute | ||||
* | * | ||||
* @param target The new Targetos value | |||||
* @param targetOS The new Targetos value | |||||
*/ | */ | ||||
public void setTargetos( String targetOS ) | public void setTargetos( String targetOS ) | ||||
throws TaskException | throws TaskException | ||||
@@ -121,13 +122,10 @@ public class PathConvert extends AbstractTask | |||||
// And Unix is everything that is not Windows | // And Unix is everything that is not Windows | ||||
// (with the exception for NetWare below) | // (with the exception for NetWare below) | ||||
String osname = System.getProperty( "os.name" ).toLowerCase(); | |||||
// for NetWare, piggy-back on Windows, since here and in the | // for NetWare, piggy-back on Windows, since here and in the | ||||
// apply code, the same assumptions can be made as with windows - | // apply code, the same assumptions can be made as with windows - | ||||
// that \\ is an OK separator, and do comparisons case-insensitive. | // that \\ is an OK separator, and do comparisons case-insensitive. | ||||
m_onWindows = ( ( osname.indexOf( "windows" ) >= 0 ) || | |||||
( osname.indexOf( "netware" ) >= 0 ) ); | |||||
m_onWindows = ( Os.isFamily( Os.OS_FAMILY_WINDOWS ) || Os.isFamily( Os.OS_FAMILY_NETWARE ) ); | |||||
// Determine the from/to char mappings for dir sep | // Determine the from/to char mappings for dir sep | ||||
char fromDirSep = m_onWindows ? '\\' : '/'; | char fromDirSep = m_onWindows ? '\\' : '/'; | ||||
@@ -845,7 +845,7 @@ public class Javadoc | |||||
{ | { | ||||
// This is the most common extension case - exe for windows and OS/2, | // This is the most common extension case - exe for windows and OS/2, | ||||
// nothing for *nix. | // nothing for *nix. | ||||
String extension = Os.isFamily( "dos" ) ? ".exe" : ""; | |||||
String extension = Os.isFamily( Os.OS_FAMILY_DOS ) ? ".exe" : ""; | |||||
// Look for javadoc in the java.home/../bin directory. Unfortunately | // Look for javadoc in the java.home/../bin directory. Unfortunately | ||||
// on Windows java.home doesn't always refer to the correct location, | // on Windows java.home doesn't always refer to the correct location, | ||||
@@ -854,17 +854,12 @@ public class Javadoc | |||||
File jdocExecutable = new File( System.getProperty( "java.home" ) + | File jdocExecutable = new File( System.getProperty( "java.home" ) + | ||||
"/../bin/javadoc" + extension ); | "/../bin/javadoc" + extension ); | ||||
if( jdocExecutable.exists() && !Os.isFamily( "netware" ) ) | |||||
if( jdocExecutable.exists() && !Os.isFamily( Os.OS_FAMILY_NETWARE ) ) | |||||
{ | { | ||||
return jdocExecutable.getAbsolutePath(); | return jdocExecutable.getAbsolutePath(); | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
if( !Os.isFamily( "netware" ) ) | |||||
{ | |||||
getLogger().debug( "Unable to locate " + jdocExecutable.getAbsolutePath() + | |||||
". Using \"javadoc\" instead." ); | |||||
} | |||||
return "javadoc"; | return "javadoc"; | ||||
} | } | ||||
} | } | ||||
@@ -17,8 +17,8 @@ import java.util.Iterator; | |||||
import org.apache.aut.nativelib.ExecManager; | import org.apache.aut.nativelib.ExecManager; | ||||
import org.apache.aut.nativelib.Os; | import org.apache.aut.nativelib.Os; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.tools.ant.taskdefs.MatchingTask; | |||||
import org.apache.myrmidon.framework.Execute; | import org.apache.myrmidon.framework.Execute; | ||||
import org.apache.tools.ant.taskdefs.MatchingTask; | |||||
import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
import org.apache.tools.ant.types.DirectoryScanner; | import org.apache.tools.ant.types.DirectoryScanner; | ||||
import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
@@ -103,7 +103,7 @@ public class Cab | |||||
getLogger().info( "Building cab: " + m_cabFile.getAbsolutePath() ); | getLogger().info( "Building cab: " + m_cabFile.getAbsolutePath() ); | ||||
if( !Os.isFamily( "windows" ) ) | |||||
if( !Os.isFamily( Os.OS_FAMILY_WINDOWS ) ) | |||||
{ | { | ||||
getLogger().debug( "Using listcab/libcabinet" ); | getLogger().debug( "Using listcab/libcabinet" ); | ||||
@@ -21,6 +21,7 @@ import java.io.Reader; | |||||
import java.io.Writer; | import java.io.Writer; | ||||
import java.util.Iterator; | import java.util.Iterator; | ||||
import java.util.NoSuchElementException; | import java.util.NoSuchElementException; | ||||
import org.apache.aut.nativelib.Os; | |||||
import org.apache.avalon.excalibur.io.FileUtil; | import org.apache.avalon.excalibur.io.FileUtil; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.tools.ant.taskdefs.MatchingTask; | import org.apache.tools.ant.taskdefs.MatchingTask; | ||||
@@ -122,25 +123,23 @@ public class FixCRLF | |||||
public FixCRLF() | public FixCRLF() | ||||
{ | { | ||||
tabs = ASIS; | tabs = ASIS; | ||||
if( File.pathSeparator.equals( ":" ) ) | |||||
if( Os.isFamily( Os.OS_FAMILY_WINDOWS) ) | |||||
{ | |||||
ctrlz = ASIS; | |||||
eol = CRLF; | |||||
eolstr = "\r\n"; | |||||
} | |||||
else if( Os.isFamily( Os.OS_FAMILY_MAC ) ) | |||||
{ | { | ||||
ctrlz = REMOVE; | ctrlz = REMOVE; | ||||
if( System.getProperty( "os.name" ).indexOf( "Mac" ) > -1 ) | |||||
{ | |||||
eol = CR; | |||||
eolstr = "\r"; | |||||
} | |||||
else | |||||
{ | |||||
eol = LF; | |||||
eolstr = "\n"; | |||||
} | |||||
eol = CR; | |||||
eolstr = "\r"; | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
ctrlz = ASIS; | |||||
eol = CRLF; | |||||
eolstr = "\r\n"; | |||||
ctrlz = REMOVE; | |||||
eol = LF; | |||||
eolstr = "\n"; | |||||
} | } | ||||
} | } | ||||
@@ -618,9 +617,7 @@ public class FixCRLF | |||||
} | } | ||||
else | else | ||||
{// (tabs != ASIS) | {// (tabs != ASIS) | ||||
int ptr; | |||||
while( ( ptr = line.getNext() ) < linelen ) | |||||
while( line.getNext() < linelen ) | |||||
{ | { | ||||
switch( lines.getState() ) | switch( lines.getState() ) | ||||
@@ -264,7 +264,7 @@ public class CommandlineJava | |||||
{ | { | ||||
// This is the most common extension case - exe for windows and OS/2, | // This is the most common extension case - exe for windows and OS/2, | ||||
// nothing for *nix. | // nothing for *nix. | ||||
String extension = Os.isFamily( "dos" ) ? ".exe" : ""; | |||||
String extension = Os.isFamily( Os.OS_FAMILY_DOS ) ? ".exe" : ""; | |||||
// Look for java in the java.home/../bin directory. Unfortunately | // Look for java in the java.home/../bin directory. Unfortunately | ||||
// on Windows java.home doesn't always refer to the correct location, | // on Windows java.home doesn't always refer to the correct location, | ||||
@@ -274,7 +274,7 @@ public class CommandlineJava | |||||
new File( System.getProperty( "java.home" ) + | new File( System.getProperty( "java.home" ) + | ||||
"/../bin/java" + extension ); | "/../bin/java" + extension ); | ||||
if( jExecutable.exists() && !Os.isFamily( "netware" ) ) | |||||
if( jExecutable.exists() && !Os.isFamily( Os.OS_FAMILY_NETWARE ) ) | |||||
{ | { | ||||
// NetWare may have a "java" in that directory, but 99% of | // NetWare may have a "java" in that directory, but 99% of | ||||
// the time, you don't want to execute it -- Jeff Tulley | // the time, you don't want to execute it -- Jeff Tulley | ||||
@@ -56,7 +56,7 @@ public class SourceFileScanner | |||||
* not have it, so if we could reliably passively test for an NTFS | * not have it, so if we could reliably passively test for an NTFS | ||||
* file systems we could turn this off... | * file systems we could turn this off... | ||||
*/ | */ | ||||
if( Os.isFamily( "windows" ) ) | |||||
if( Os.isFamily( Os.OS_FAMILY_WINDOWS ) ) | |||||
{ | { | ||||
now += 2000; | now += 2000; | ||||
} | } | ||||