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

Commit 2fb124e

Browse files
Making sure all paths get deleted
1 parent b778c9e commit 2fb124e

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/GitHub.Api/Installer/PortableGitInstallTask.cs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ private bool InstallGit(NPath targetPath)
168168
{
169169
Logger.Trace("InstallGit");
170170

171-
var tempPath = NPath.CreateTempDirectory("git_zip_path");
172-
var gitArchivePath = AssemblyResources.ToFile(ResourceType.Platform, "git.zip", tempPath, environment);
171+
var tempZipPath = NPath.CreateTempDirectory("git_zip_path");
172+
var gitArchivePath = AssemblyResources.ToFile(ResourceType.Platform, "git.zip", tempZipPath, environment);
173173

174174
if (!environment.FileSystem.FileExists(gitArchivePath))
175175
{
@@ -195,7 +195,7 @@ private bool InstallGit(NPath targetPath)
195195
return false;
196196
}
197197

198-
tempPath.DeleteIfExists();
198+
tempZipPath.DeleteIfExists();
199199

200200
return true;
201201
}
@@ -204,8 +204,8 @@ private bool InstallGitLfs(NPath targetPath)
204204
{
205205
Logger.Trace("InstallGitLfs");
206206

207-
var tempPath = NPath.CreateTempDirectory("git_lfs_zip_path");
208-
var gitLfsArchivePath = AssemblyResources.ToFile(ResourceType.Platform, "git-lfs.zip", tempPath, environment);
207+
var tempZipPath = NPath.CreateTempDirectory("git_lfs_zip_path");
208+
var gitLfsArchivePath = AssemblyResources.ToFile(ResourceType.Platform, "git-lfs.zip", tempZipPath, environment);
209209

210210
if (!environment.FileSystem.FileExists(gitLfsArchivePath))
211211
{
@@ -215,22 +215,22 @@ private bool InstallGitLfs(NPath targetPath)
215215

216216
Token.ThrowIfCancellationRequested();
217217

218-
var tempDirectory = NPath.CreateTempDirectory("git_lfs_extract_path");
218+
var tempZipExtractPath = NPath.CreateTempDirectory("git_lfs_extract_path");
219219

220220
try
221221
{
222-
Logger.Trace("Extracting gitLfsArchivePath:\"{0}\" tempDirectory:\"{1}\"", gitLfsArchivePath, tempDirectory);
223-
ZipHelper.ExtractZipFile(gitLfsArchivePath, tempDirectory, Token);
222+
Logger.Trace("Extracting gitLfsArchivePath:\"{0}\" tempDirectory:\"{1}\"", gitLfsArchivePath, tempZipExtractPath);
223+
ZipHelper.ExtractZipFile(gitLfsArchivePath, tempZipExtractPath, Token);
224224
}
225225
catch (Exception ex)
226226
{
227-
Logger.Warning(ex, $"Error Extracting gitLfsArchivePath:\"{gitLfsArchivePath}\" tempDirectory:\"{tempDirectory}\"");
227+
Logger.Warning(ex, $"Error Extracting gitLfsArchivePath:\"{gitLfsArchivePath}\" tempDirectory:\"{tempZipExtractPath}\"");
228228
return false;
229229
}
230230

231231
Token.ThrowIfCancellationRequested();
232232

233-
var tempDirectoryGitLfsExec = tempDirectory.Combine(installDetails.GitLfsExec);
233+
var tempDirectoryGitLfsExec = tempZipExtractPath.Combine(installDetails.GitLfsExec);
234234

235235
var targetLfsExecPath = installDetails.GetGitLfsExecPath(targetPath);
236236
try
@@ -244,8 +244,9 @@ private bool InstallGitLfs(NPath targetPath)
244244
return false;
245245
}
246246

247-
Logger.Trace("Deleting tempDirectory:\"{0}\"", tempDirectory);
248-
tempDirectory.DeleteIfExists();
247+
tempZipPath.DeleteIfExists();
248+
tempZipExtractPath.DeleteIfExists();
249+
249250
return true;
250251
}
251252
}

0 commit comments

Comments
 (0)