コード例 #1
0
        private IEnumerable <string> GetGitLocations()
        {
            yield return
                (CommonLogic.GetRegistryValue(Registry.LocalMachine,
                                              "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Git_is1", "InstallLocation"));

            string programFiles    = Environment.GetEnvironmentVariable("ProgramFiles");
            string programFilesX86 = null;

            if (8 == IntPtr.Size ||
                !String.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432")))
            {
                programFilesX86 = Environment.GetEnvironmentVariable("ProgramFiles(x86)");
            }
            if (programFilesX86 != null)
            {
                yield return(programFilesX86 + @"\Git\");
            }
            yield return(programFiles + @"\Git\");

            if (programFilesX86 != null)
            {
                yield return(programFilesX86 + @"\msysgit\");
            }
            yield return(programFiles + @"\msysgit\");

            yield return(@"C:\msysgit\");

            // cygwin has old git version on windows and bash has a lot of bugs
            yield return(@"C:\cygwin\");
        }
コード例 #2
0
        private static IEnumerable <string> GetGitLocations()
        {
            string envVariable = Environment.GetEnvironmentVariable("GITEXT_GIT");

            if (!string.IsNullOrEmpty(envVariable))
            {
                yield return(envVariable);
            }

            yield return
                (CommonLogic.GetRegistryValue(Registry.LocalMachine,
                                              "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Git_is1", "InstallLocation"));

            string programFiles    = Environment.GetEnvironmentVariable("ProgramFiles");
            string programFilesX86 = null;

            if (IntPtr.Size == 8 ||
                !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432")))
            {
                programFilesX86 = Environment.GetEnvironmentVariable("ProgramFiles(x86)");
            }

            if (programFilesX86 != null)
            {
                yield return(programFilesX86 + @"\Git\");
            }

            yield return(programFiles + @"\Git\");

            if (programFilesX86 != null)
            {
                yield return(programFilesX86 + @"\msysgit\");
            }

            yield return(programFiles + @"\msysgit\");

            yield return(@"C:\msysgit\");

            // cygwin has old git version on windows and bash has a lot of bugs
            yield return(@"C:\cygwin\");

            yield return(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
                                      "Programs", "Git\\"));
        }