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

Commit 2cc6997

Browse files
Merge pull request #945 from github-for-unity/init-error
Fixing GitHub for Unity initialization
2 parents a3f9d3c + be41884 commit 2cc6997

File tree

3 files changed

+16
-15
lines changed

3 files changed

+16
-15
lines changed

src/GitHub.Api/Installer/CopyHelper.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,23 @@ public static class CopyHelper
1212

1313
public static void Copy(NPath fromPath, NPath toPath)
1414
{
15+
Logger.Trace("Copying from " + fromPath + " to " + toPath + ".");
16+
1517
try
1618
{
17-
1819
CopyFolder(fromPath, toPath);
1920
}
2021
catch (Exception ex1)
2122
{
22-
Logger.Warning(ex1, "Error copying from " + fromPath + " to " + toPath + ". Attempting to copy contents.");
23+
Logger.Warning(ex1, "Error copying.");
2324

2425
try
2526
{
2627
CopyFolderContents(fromPath, toPath);
2728
}
2829
catch (Exception ex2)
2930
{
30-
Logger.Error(ex2, "Error copying from " + fromPath + " to " + toPath + ".");
31+
Logger.Error(ex1, "Error copying contents.");
3132
throw;
3233
}
3334
}
@@ -39,15 +40,14 @@ public static void Copy(NPath fromPath, NPath toPath)
3940
public static void CopyFolder(NPath fromPath, NPath toPath)
4041
{
4142
Logger.Trace("CopyFolder fromPath: {0} toPath:{1}", fromPath.ToString(), toPath.ToString());
42-
43+
toPath.DeleteIfExists();
4344
toPath.EnsureParentDirectoryExists();
4445
fromPath.Move(toPath);
4546
}
4647

4748
public static void CopyFolderContents(NPath fromPath, NPath toPath)
4849
{
49-
Logger.Trace("CopyFolderContents fromPath: {0} toPath:{1}", fromPath.ToString(), toPath.ToString());
50-
50+
Logger.Trace("CopyFolder Contents fromPath: {0} toPath:{1}", fromPath.ToString(), toPath.ToString());
5151
toPath.DeleteContents();
5252
fromPath.MoveFiles(toPath, true);
5353
}

src/GitHub.Api/Installer/GitInstaller.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,13 @@ private GitInstallationState ExtractGit(GitInstallationState state)
301301
return true;
302302
});
303303
unzipTask.Progress(p => Progress.UpdateProgress(40 + (long)(20 * p.Percentage), 100, unzipTask.Message));
304-
var source = unzipTask.RunSynchronously();
304+
unzipTask.RunSynchronously();
305305
var target = state.GitInstallationPath;
306306
if (unzipTask.Successful)
307307
{
308-
Logger.Trace("Moving Git source:{0} target:{1}", source.ToString(), target.ToString());
308+
Logger.Trace("Moving Git source:{0} target:{1}", gitExtractPath.ToString(), target.ToString());
309309

310-
CopyHelper.Copy(source, target);
310+
CopyHelper.Copy(gitExtractPath, target);
311311

312312
state.GitIsValid = true;
313313

@@ -327,13 +327,13 @@ private GitInstallationState ExtractGit(GitInstallationState state)
327327
return true;
328328
});
329329
unzipTask.Progress(p => Progress.UpdateProgress(60 + (long)(20 * p.Percentage), 100, unzipTask.Message));
330-
var source = unzipTask.RunSynchronously();
330+
unzipTask.RunSynchronously();
331331
var target = state.GitLfsInstallationPath;
332332
if (unzipTask.Successful)
333333
{
334-
Logger.Trace("Moving GitLFS source:{0} target:{1}", source.ToString(), target.ToString());
334+
Logger.Trace("Moving GitLFS source:{0} target:{1}", gitLfsExtractPath.ToString(), target.ToString());
335335

336-
CopyHelper.Copy(source, target);
336+
CopyHelper.Copy(gitLfsExtractPath, target);
337337

338338
state.GitLfsIsValid = true;
339339
}

src/GitHub.Api/Installer/OctorunInstaller.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@ public NPath SetupOctorunIfNeeded()
3333

3434
GrabZipFromResources();
3535

36-
var tempZipExtractPath = NPath.CreateTempDirectory("octorun_extract_archive_path");
36+
var extractPath = NPath.CreateTempDirectory("octorun_extract_archive_path");
3737
var unzipTask = new UnzipTask(taskManager.Token, installDetails.ZipFile,
38-
tempZipExtractPath, sharpZipLibHelper,
38+
extractPath, sharpZipLibHelper,
3939
fileSystem)
4040
.Catch(e => { Logger.Error(e, "Error extracting octorun"); return true; });
41-
var extractPath = unzipTask.RunSynchronously();
41+
unzipTask.RunSynchronously();
42+
4243
if (unzipTask.Successful)
4344
path = MoveOctorun(extractPath.Combine("octorun"));
4445
return path;

0 commit comments

Comments
 (0)