Exemplo n.º 1
0
        private bool IsPortableGitExtracted()
        {
            if (!GitExecutablePath.FileExists())
            {
                logger.Trace("{0} not installed yet", GitExecutablePath);
                return(false);
            }

            logger.Trace("Git Present");

            return(true);
        }
Exemplo n.º 2
0
        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);
        }