Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit d428452

Browse files
Moving downloaded zip files to a known and resumable location
1 parent 57dccc4 commit d428452

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/GitHub.Api/Installer/GitInstaller.cs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@ class GitInstallDetails
2424

2525
private readonly bool onWindows;
2626

27-
public GitInstallDetails(NPath targetInstallPath, bool onWindows)
27+
public GitInstallDetails(NPath applicationDataPath, bool onWindows)
2828
{
2929
this.onWindows = onWindows;
30-
var gitInstallPath = targetInstallPath.Combine(ApplicationInfo.ApplicationName, PackageNameWithVersion);
30+
31+
PluginDataPath = applicationDataPath.Combine(ApplicationInfo.ApplicationName);
32+
33+
var gitInstallPath = PluginDataPath.Combine(PackageNameWithVersion);
3134
GitInstallationPath = gitInstallPath;
3235

3336
if (onWindows)
@@ -55,6 +58,7 @@ public NPath GetGitLfsExecutablePath(NPath gitInstallRoot)
5558
: gitInstallRoot.Combine("libexec", "git-core", GitLfsExecutable);
5659
}
5760

61+
public NPath PluginDataPath { get; }
5862
public NPath GitInstallationPath { get; }
5963
public string GitExecutable { get; }
6064
public NPath GitExecutablePath { get; }
@@ -177,21 +181,20 @@ private NPath MoveGitAndLfs(NPath gitExtractPath, NPath gitLfsExtractPath, NPath
177181

178182
private ITask CreateDownloadTask()
179183
{
180-
var tempZipPath = NPath.CreateTempDirectory("git_zip_paths");
181-
gitArchiveFilePath = tempZipPath.Combine("git.zip");
182-
gitLfsArchivePath = tempZipPath.Combine("git-lfs.zip");
184+
gitArchiveFilePath = installDetails.PluginDataPath.Combine("git.zip");
185+
gitLfsArchivePath = installDetails.PluginDataPath.Combine("git-lfs.zip");
183186

184187
var downloadGitMd5Task = new DownloadTextTask(TaskManager.Instance.Token, environment.FileSystem,
185-
installDetails.GitZipMd5Url, tempZipPath);
188+
installDetails.GitZipMd5Url, installDetails.PluginDataPath);
186189

187190
var downloadGitTask = new DownloadTask(TaskManager.Instance.Token, environment.FileSystem,
188-
installDetails.GitZipUrl, tempZipPath);
191+
installDetails.GitZipUrl, installDetails.PluginDataPath);
189192

190193
var downloadGitLfsMd5Task = new DownloadTextTask(TaskManager.Instance.Token, environment.FileSystem,
191-
installDetails.GitLfsZipMd5Url, tempZipPath);
194+
installDetails.GitLfsZipMd5Url, installDetails.PluginDataPath);
192195

193196
var downloadGitLfsTask = new DownloadTask(TaskManager.Instance.Token, environment.FileSystem,
194-
installDetails.GitLfsZipUrl, tempZipPath);
197+
installDetails.GitLfsZipUrl, installDetails.PluginDataPath);
195198

196199
return
197200
downloadGitMd5Task.Then((b, s) => { downloadGitTask.ValidationHash = s; })

0 commit comments

Comments
 (0)