Skip to content

Commit

Permalink
Merge pull request #341 from sillsdev/bug/wrong-executable-used-on-wi…
Browse files Browse the repository at this point in the history
…ndows

Use correct hg executable on Windows
  • Loading branch information
hahn-kev authored May 21, 2024
2 parents 38ecab3 + c8a5524 commit 104ce40
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/LibChorus/MercurialLocation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
public class MercurialLocation
{
private static string _pathToMercurialFolder;
private static string _hgExe = Platform.IsWindows ? "hg.exe" : "hg";

/// <summary>
/// Clients can set this if they have their own private copy of Mercurial (recommended)
Expand All @@ -31,7 +32,7 @@ public static string PathToMercurialFolder
return;
}
RequireThat.Directory(value).Exists();
string expectedHgLocation=Path.Combine(value, Platform.IsWindows ? "hg.exe" : "hg");
string expectedHgLocation=Path.Combine(value, _hgExe);
if (!File.Exists(expectedHgLocation))
{
throw new FileNotFoundException(expectedHgLocation);
Expand All @@ -50,8 +51,8 @@ public static string PathToHgExecutable
GuessAtLocationIfNotSetAlready();

if(string.IsNullOrEmpty(_pathToMercurialFolder))
return "hg"; //rely on the PATH
return Path.Combine(_pathToMercurialFolder, "hg");
return _hgExe; //rely on the PATH
return Path.Combine(_pathToMercurialFolder, _hgExe);
}
}

Expand Down

0 comments on commit 104ce40

Please sign in to comment.