Skip to content

Commit 3f8fe0e

Browse files
authored
Merge pull request #1836 from tyrielv/where
Make hooks location check consistent
2 parents e9dd3d0 + 42489cc commit 3f8fe0e

File tree

4 files changed

+4
-15
lines changed

4 files changed

+4
-15
lines changed

GVFS/GVFS.Common/GVFSPlatform.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ public abstract class GVFSPlatformConstants
143143

144144
public abstract string GVFSExecutableName { get; }
145145

146-
public abstract string ProgramLocaterCommand { get; }
147146

148147
/// <summary>
149148
/// Different platforms can have different requirements

GVFS/GVFS.Platform.Windows/WindowsGitInstallation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public bool GitExists(string gitBinPath)
1919
return File.Exists(gitBinPath);
2020
}
2121

22-
return ProcessHelper.GetProgramLocation(GVFSPlatform.Instance.Constants.ProgramLocaterCommand, GitProcessName) != null;
22+
return !string.IsNullOrEmpty(GetInstalledGitBinPath());
2323
}
2424

2525
public string GetInstalledGitBinPath()

GVFS/GVFS.Platform.Windows/WindowsPlatform.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -258,14 +258,14 @@ public override bool TryGetGVFSHooksVersion(out string hooksVersion, out string
258258
{
259259
error = null;
260260
hooksVersion = null;
261-
string hooksPath = ProcessHelper.GetProgramLocation(GVFSPlatform.Instance.Constants.ProgramLocaterCommand, GVFSPlatform.Instance.Constants.GVFSHooksExecutableName);
262-
if (hooksPath == null)
261+
string hooksPath = Path.Combine(ProcessHelper.GetCurrentProcessLocation(), GVFSPlatform.Instance.Constants.GVFSHooksExecutableName);
262+
if (hooksPath == null || !File.Exists(hooksPath))
263263
{
264264
error = "Could not find " + GVFSPlatform.Instance.Constants.GVFSHooksExecutableName;
265265
return false;
266266
}
267267

268-
FileVersionInfo hooksFileVersionInfo = FileVersionInfo.GetVersionInfo(Path.Combine(hooksPath, GVFSPlatform.Instance.Constants.GVFSHooksExecutableName));
268+
FileVersionInfo hooksFileVersionInfo = FileVersionInfo.GetVersionInfo(hooksPath);
269269
hooksVersion = hooksFileVersionInfo.ProductVersion;
270270
return true;
271271
}
@@ -444,11 +444,6 @@ public override string GVFSExecutableName
444444
get { return "GVFS" + this.ExecutableExtension; }
445445
}
446446

447-
public override string ProgramLocaterCommand
448-
{
449-
get { return "where"; }
450-
}
451-
452447
public override HashSet<string> UpgradeBlockingProcesses
453448
{
454449
get { return new HashSet<string>(GVFSPlatform.Instance.Constants.PathComparer) { "GVFS", "GVFS.Mount", "git", "ssh-agent", "wish", "bash" }; }

GVFS/GVFS.UnitTests/Mock/Common/MockPlatform.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,6 @@ public override string GVFSExecutableName
221221
{
222222
get { return "MockGVFS" + this.ExecutableExtension; }
223223
}
224-
225-
public override string ProgramLocaterCommand
226-
{
227-
get { return "MockWhere"; }
228-
}
229224

230225
public override HashSet<string> UpgradeBlockingProcesses
231226
{

0 commit comments

Comments
 (0)