Ejemplo n.º 1
0
        public static IEnvironmentPathInstruction CreateEnvironmentPathInstruction(
            IEnvironmentProvider environmentProvider = null)
        {
            if (environmentProvider == null)
            {
                environmentProvider = new EnvironmentProvider();
            }

            if (OperatingSystem.IsMacOS() && ZshDetector.IsZshTheUsersShell(environmentProvider))
            {
                return(new OsxZshEnvironmentPathInstruction(
                           executablePath: CliFolderPathCalculator.ToolsShimPathInUnix,
                           reporter: Reporter.Output,
                           environmentProvider: environmentProvider));
            }

            if (OperatingSystem.IsWindows())
            {
                return(new WindowsEnvironmentPath(
                           CliFolderPathCalculator.ToolsShimPath,
                           nonExpandedPackageExecutablePath: CliFolderPathCalculator.WindowsNonExpandedToolsShimPath,
                           expandedEnvironmentReader: environmentProvider,
                           environmentPathEditor: new WindowsRegistryEnvironmentPathEditor(),
                           reporter: Reporter.Output));
            }

            return(CreateEnvironmentPath(true, environmentProvider));
        }
Ejemplo n.º 2
0
        public static IEnvironmentPathInstruction CreateEnvironmentPathInstruction(
            IEnvironmentProvider environmentProvider = null)
        {
            if (environmentProvider == null)
            {
                environmentProvider = new EnvironmentProvider();
            }

            if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) && ZshDetector.IsZshTheUsersShell(environmentProvider))
            {
                return(new OsxZshEnvironmentPathInstruction(
                           executablePath: CliFolderPathCalculator.ToolsShimPathInUnix,
                           reporter: Reporter.Output,
                           environmentProvider: environmentProvider));
            }

            return(CreateEnvironmentPath(true, environmentProvider));
        }