mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
feature<Preference>: try finding git.exe
automatically
This commit is contained in:
parent
5e706588a0
commit
adce866716
1 changed files with 12 additions and 6 deletions
|
@ -49,12 +49,18 @@ namespace SourceGit.Views {
|
|||
}
|
||||
|
||||
private void SelectGitPath(object sender, RoutedEventArgs e) {
|
||||
var dialog = new OpenFileDialog();
|
||||
dialog.Filter = "Git Executable|git.exe";
|
||||
dialog.FileName = "git.exe";
|
||||
dialog.Title = App.Text("Preference.Dialog.GitExe");
|
||||
dialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
|
||||
dialog.CheckFileExists = true;
|
||||
var sb = new StringBuilder("git.exe");
|
||||
string dir = PathFindOnPath(sb, null)
|
||||
? sb.ToString()
|
||||
: Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
|
||||
|
||||
var dialog = new OpenFileDialog {
|
||||
Filter = "Git Executable|git.exe",
|
||||
FileName = "git.exe",
|
||||
Title = App.Text("Preference.Dialog.GitExe"),
|
||||
InitialDirectory = dir,
|
||||
CheckFileExists = true,
|
||||
};
|
||||
|
||||
if (dialog.ShowDialog() == true) {
|
||||
Models.Preference.Instance.Git.Path = dialog.FileName;
|
||||
|
|
Loading…
Reference in a new issue