Class OperatingSystem


  • public final class OperatingSystem
    extends Object
    An 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 binary
        path - the PATH environment variable
        Returns:
        the fully-qualified path of the executable
        Throws:
        NullPointerException - if any of the arguments are null
        FileNotFoundException - 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 a ProcessBuilder's environment variable.
        Parameters:
        processBuilder - a ProcessBuilder
        name - 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 variables
        target - existing environment variables
        Throws:
        NullPointerException - if any of the arguments are null