コード例 #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));
        }
コード例 #2
0
ファイル: EnvironmentPathFactory.cs プロジェクト: xontab/sdk
        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));
        }