From 884c9fdd3e18eb740f6d5435e2e8fabdb7dfad88 Mon Sep 17 00:00:00 2001 From: "KIM, JINWOOK" Date: Wed, 8 Jun 2016 22:25:24 +0900 Subject: [PATCH] Show message box when cannot find git binary instead of crash. Add x64 git binary path --- WimyGit/ProgramPathFinder.cs | 3 ++- WimyGit/ViewModel.cs | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/WimyGit/ProgramPathFinder.cs b/WimyGit/ProgramPathFinder.cs index d92b977..1bede4b 100644 --- a/WimyGit/ProgramPathFinder.cs +++ b/WimyGit/ProgramPathFinder.cs @@ -12,6 +12,7 @@ public static string GetGitBin() { string[] git_path_candidates = { + @"C:\Program Files\Git\bin\git.exe", @"C:\Program Files (x86)\Git\bin\git.exe", @"C:\Users\" + Environment.UserName + @"\AppData\Local\Programs\Git\bin\git.exe", }; @@ -23,7 +24,7 @@ public static string GetGitBin() return path; } } - throw new Exception("Cannot find git binary"); + throw new System.IO.FileNotFoundException("Cannot find git binary"); } public static string GetGitShell() diff --git a/WimyGit/ViewModel.cs b/WimyGit/ViewModel.cs index cdd51b6..402c6b0 100644 --- a/WimyGit/ViewModel.cs +++ b/WimyGit/ViewModel.cs @@ -59,9 +59,17 @@ public void OnChangeDirectory(object parameter) git_ = new GitWrapper(Directory); Service.GetInstance().SetRootPath(Directory); - Refresh(); - DirectoryUsed(Directory); + try + { + Refresh(); + DirectoryUsed(Directory); + } + catch (System.IO.FileNotFoundException ex) + { + Service.GetInstance().ShowMsg(ex.Message); + System.Environment.Exit(1); + } } public void Refresh()