public GitInstaller(IEnvironment environment, IZipHelper sharpZipLibHelper, CancellationToken cancellationToken) { Guard.ArgumentNotNull(environment, nameof(environment)); logger = Logging.GetLogger(GetType()); this.cancellationToken = cancellationToken; this.environment = environment; this.extractCallback = sharpZipLibHelper != null ? (ExtractZipFile)sharpZipLibHelper.Extract : ZipHelper.ExtractZipFile; GitInstallationPath = environment.GetSpecialFolder(Environment.SpecialFolder.LocalApplicationData) .ToNPath().Combine(ApplicationInfo.ApplicationName, PackageNameWithVersion); var gitExecutable = "git"; var gitLfsExecutable = "git-lfs"; if (DefaultEnvironment.OnWindows) { gitExecutable += ".exe"; gitLfsExecutable += ".exe"; } GitLfsExecutable = gitLfsExecutable; GitExecutable = gitExecutable; GitExecutablePath = GitInstallationPath; if (DefaultEnvironment.OnWindows) { GitExecutablePath = GitExecutablePath.Combine("cmd"); } else { GitExecutablePath = GitExecutablePath.Combine("bin"); } GitExecutablePath = GitExecutablePath.Combine(GitExecutable); GitLfsExecutablePath = GitInstallationPath; if (DefaultEnvironment.OnWindows) { GitLfsExecutablePath = GitLfsExecutablePath.Combine("mingw32"); } GitLfsExecutablePath = GitLfsExecutablePath.Combine("libexec", "git-core", GitLfsExecutable); }
public GitInstallDetails(NPath baseDataPath, IEnvironment environment) { ZipPath = baseDataPath.Combine("downloads"); ZipPath.EnsureDirectoryExists(); GitInstallationPath = baseDataPath.Combine(GitDirectory); GitExecutablePath = GitInstallationPath.Combine(environment.IsWindows ? "cmd" : "bin", "git" + DefaultEnvironment.ExecutableExt); GitLfsInstallationPath = GitLfsExecutablePath = GitInstallationPath; if (environment.IsWindows) { GitLfsExecutablePath = GitLfsInstallationPath.Combine(environment.Is32Bit ? "mingw32" : "mingw64"); } GitLfsExecutablePath = GitLfsExecutablePath.Combine("libexec", "git-core"); GitLfsExecutablePath = GitLfsExecutablePath.Combine("git-lfs" + DefaultEnvironment.ExecutableExt); GitManifest = baseDataPath.Combine(GitPackageName); }
public bool IsGitLfsExtracted() { if (!GitLfsExecutablePath.FileExists()) { logger.Trace("{0} not installed yet", GitLfsExecutablePath); return(false); } var calculateMd5 = environment.FileSystem.CalculateMD5(GitLfsExecutablePath); logger.Trace("GitLFS MD5: {0}", calculateMd5); var md5 = environment.IsWindows ? WindowsGitLfsExecutableMD5 : MacGitLfsExecutableMD5; if (String.Compare(calculateMd5, md5, true) != 0) { logger.Trace("{0} has incorrect MD5", GitExecutablePath); return(false); } logger.Trace("GitLFS Present"); return(true); }