Class OperatingSystemUtils


  • public final class OperatingSystemUtils
    extends Object
    NOTE: This class was copied from plexus-utils, to allow this library to stand completely self-contained.
    Author:
    Trygve Laugstøl
    • Method Detail

      • getSystemEnvVars

        public static Properties getSystemEnvVars​(boolean caseSensitive)
                                           throws IOException
        Return the shell environment variables. If caseSensitive == true, then envar keys will all be upper-case.
        Parameters:
        caseSensitive - Whether environment variable keys should be treated case-sensitively.
        Returns:
        Properties object of (possibly modified) envar keys mapped to their values.
        Throws:
        IOException - in case of an error.
      • setEnvVarSource

        public static void setEnvVarSource​(OperatingSystemUtils.EnvVarSource source)
        Set the source object to load the environment variables from. Default implementation should suffice. This is mostly for testing.
        Parameters:
        source - the EnvVarSource instance that loads the environment variables.
        Since:
        3.1.2