private GitInstallationState ExtractGit(GitInstallationState state) { var tempZipExtractPath = NPath.CreateTempDirectory("ghu_extract_git"); if (state.GitZipExists && !state.GitIsValid) { var gitExtractPath = tempZipExtractPath.Combine("git").CreateDirectory(); var unzipTask = new UnzipTask(cancellationToken, state.GitZipPath, gitExtractPath, sharpZipLibHelper, environment.FileSystem) .Progress(progressReporter.UpdateProgress) .Catch(e => { LogHelper.Trace(e, "Failed to unzip " + state.GitZipPath); return(true); }); unzipTask.RunSynchronously(); var target = state.GitInstallationPath; if (unzipTask.Successful) { Logger.Trace("Moving Git source:{0} target:{1}", gitExtractPath.ToString(), target.ToString()); CopyHelper.Copy(gitExtractPath, target); state.GitIsValid = true; state.IsCustomGitPath = state.GitExecutablePath != installDetails.GitExecutablePath; } } tempZipExtractPath.DeleteIfExists(); return(state); }
public NPath SetupOctorunIfNeeded() { NPath path = NPath.Default; var isOctorunExtracted = IsOctorunExtracted(); if (isOctorunExtracted) { return(installDetails.ExecutablePath); } GrabZipFromResources(); var extractPath = NPath.CreateTempDirectory("octorun_extract_archive_path"); var unzipTask = new UnzipTask(taskManager.Token, installDetails.ZipFile, extractPath, sharpZipLibHelper, fileSystem) .Catch(e => { Logger.Error(e, "Error extracting octorun"); return(true); }); unzipTask.RunSynchronously(); if (unzipTask.Successful) { path = MoveOctorun(extractPath.Combine("octorun")); } return(path); }