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

Commit ff3a3e8

Browse files
Finding the executable if it cannot be installed
1 parent 4351c31 commit ff3a3e8

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

src/GitHub.Api/Application/ApplicationManagerBase.cs

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public void Run(bool firstRun)
6868
}).Start();
6969
});
7070

71-
var afterPathDetermined = new ActionTask<NPath>(CancellationToken, (b1, path) => {
71+
var afterPathDetermined = new ActionTask<NPath>(CancellationToken, (b, path) => {
7272

7373
Logger.Trace("Setting Environment git path: {0}", path);
7474
Environment.GitExecutablePath = path;
@@ -87,19 +87,38 @@ public void Run(bool firstRun)
8787
}
8888
});
8989

90+
var findExecTask = new FindExecTask("git", CancellationToken)
91+
.Finally((b, ex, path) => {
92+
if (b && path != null)
93+
{
94+
Logger.Trace("FindExecTask Success: {0}", path);
95+
96+
new FuncTask<NPath>(CancellationToken, () => path)
97+
.Then(afterPathDetermined)
98+
.Start();
99+
}
100+
else
101+
{
102+
Logger.Warning("FindExecTask Failure");
103+
Logger.Error("Git not found");
104+
}
105+
});
106+
90107
var applicationDataPath = Environment.GetSpecialFolder(System.Environment.SpecialFolder.LocalApplicationData).ToNPath();
91108
var installDetails = new GitInstallDetails(applicationDataPath, true);
92109
var gitInstaller = new GitInstaller(Environment, CancellationToken, installDetails);
93-
gitInstaller.SetupGitIfNeeded(new ActionTask<NPath>(CancellationToken, (b, s) => {
110+
gitInstaller.SetupGitIfNeeded(new ActionTask<NPath>(CancellationToken, (b, path) => {
94111

95-
Logger.Trace("Success: {0}", s);
112+
Logger.Trace("GitInstaller Success: {0}", path);
96113

97-
new FuncTask<NPath>(CancellationToken, () => s)
114+
new FuncTask<NPath>(CancellationToken, () => path)
98115
.Then(afterPathDetermined)
99116
.Start();
100117

101118
}), new ActionTask(CancellationToken, () => {
102-
Logger.Trace("Failure");
119+
Logger.Warning("GitInstaller Failure");
120+
121+
findExecTask.Start();
103122
}) );
104123
}
105124

0 commit comments

Comments
 (0)