Package com.googlecode.cmakemavenproject
Class OperatingSystem
- java.lang.Object
-
- com.googlecode.cmakemavenproject.OperatingSystem
-
public final class OperatingSystem extends Object
An operating system.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOperatingSystem.ArchitectureThe architecture of an operating system.static classOperatingSystem.TypeOperating system types.
-
Field Summary
Fields Modifier and Type Field Description OperatingSystem.ArchitecturearchitectureThe architecture of the operating system.OperatingSystem.TypetypeThe type of the operating system.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static OperatingSystemdetected()Returns the detected operating system.StringgetClassifier()Returns the classifier associated with this operating system.StringgetDownloadSuffix()Returns the suffix to append to the cmake download filename.StringgetEnvironment(ProcessBuilder processBuilder, String name)Returns the value of aProcessBuilder's environment variable.PathgetExecutableOnPath(String filename, String path)Returns the fully-qualified path of the executable.StringgetExecutableSuffix()Returns the suffix to append to the cmake executables.voidoverrideEnvironmentVariables(Map<String,String> source, ProcessBuilder target)Overrides the environment variables of a process builder.booleansupportsPosix(InputStream in)Indicates if the operating system supports POSIX attributes.StringtoString()
-
-
-
Field Detail
-
type
public final OperatingSystem.Type type
The type of the operating system.
-
architecture
public final OperatingSystem.Architecture architecture
The architecture of the operating system.
-
-
Method Detail
-
detected
public static OperatingSystem detected()
Returns the detected operating system.- Returns:
- the detected operating system
- Throws:
AssertionError- if the operating system is unsupported
-
getClassifier
public String getClassifier()
Returns the classifier associated with this operating system.- Returns:
- the classifier associated with this operating system
- Throws:
UnsupportedOperationException- if the operating system was unsupported
-
getExecutableOnPath
public Path getExecutableOnPath(String filename, String path) throws FileNotFoundException
Returns the fully-qualified path of the executable.- Parameters:
filename- the filename of a binarypath- thePATHenvironment variable- Returns:
- the fully-qualified path of the executable
- Throws:
NullPointerException- if any of the arguments are nullFileNotFoundException- if the binary could not be found
-
getExecutableSuffix
public String getExecutableSuffix()
Returns the suffix to append to the cmake executables.- Returns:
- the suffix to append to the cmake executables
- Throws:
UnsupportedOperationException- if the operating system was unsupported
-
getDownloadSuffix
public String getDownloadSuffix()
Returns the suffix to append to the cmake download filename.- Returns:
- the suffix to append to the cmake download filename
- Throws:
UnsupportedOperationException- if the operating system was unsupported
-
supportsPosix
public boolean supportsPosix(InputStream in)
Indicates if the operating system supports POSIX attributes.- Parameters:
in- the InputStream associated with the archive- Returns:
- true if the operating system supports POSIX attributes
- Throws:
UnsupportedOperationException- if the operating system was unsupported
-
getEnvironment
public String getEnvironment(ProcessBuilder processBuilder, String name)
Returns the value of aProcessBuilder's environment variable.- Parameters:
processBuilder- aProcessBuildername- an environment variable- Returns:
- the value of the environment variable
-
overrideEnvironmentVariables
public void overrideEnvironmentVariables(Map<String,String> source, ProcessBuilder target)
Overrides the environment variables of a process builder.- Parameters:
source- new environment variablestarget- existing environment variables- Throws:
NullPointerException- if any of the arguments are null
-
-