//#include "vld.h"\r
#include "TortoiseProc.h"\r
#include "SysImageList.h"\r
-//#include "CrashReport.h"\r
+#include "CrashReport.h"\r
#include "CmdLineParser.h"\r
#include "Hooks.h"\r
#include "AppUtils.h"\r
END_MESSAGE_MAP()\r
\r
CString g_version;\r
-\r
+CString CGit::m_MsysGitPath;\r
//////////////////////////////////////////////////////////////////////////\r
\r
CTortoiseProcApp::CTortoiseProcApp()\r
HWND hWndExplorer;\r
CString sOrigCWD;\r
\r
-//CCrashReport crasher("crashreports@tortoisesvn.tigris.org", "Crash Report for TortoiseSVN " APP_X64_STRING " : " STRPRODUCTVER, TRUE);// crash\r
+BOOL CTortoiseProcApp::CheckMsysGitDir()\r
+{\r
+ CRegString msysdir=CRegString(_T("Software\\TortoiseGit\\MSysGit"),_T(""),FALSE,HKEY_LOCAL_MACHINE);\r
+ CString str=msysdir;\r
+ if(str.IsEmpty())\r
+ {\r
+ CRegString msysinstalldir=CRegString(_T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Git_is1\\InstallLocation"),_T(""),FALSE,HKEY_LOCAL_MACHINE);\r
+ str=msysinstalldir;\r
+ str+="\\bin";\r
+ msysdir=str;\r
+ msysdir.write();\r
+\r
+ }\r
+ CGit::m_MsysGitPath=str;\r
+\r
+ TCHAR *oldpath,*home;\r
+ size_t size;\r
+\r
+ _tdupenv_s(&home,&size,_T("HOME")); \r
+ \r
+ if(home == NULL)\r
+ { \r
+ _tdupenv_s(&home,&size,_T("USERPROFILE")); \r
+ _tputenv_s(_T("HOME"),home);\r
+ free(home);\r
+ }\r
+ //set path\r
+ _tdupenv_s(&oldpath,&size,_T("PATH")); \r
+\r
+ CString path;\r
+ path.Format(_T("%s;"),str);\r
+ path+=oldpath;\r
+\r
+ _tputenv_s(_T("PATH"),path);\r
+\r
+ free(oldpath);\r
+\r
+ CString cmd,out;\r
+ cmd=_T("git.exe --version");\r
+ if(g_Git.Run(cmd,&out))\r
+ {\r
+ return false;\r
+ }\r
+ else\r
+ return true;\r
+ \r
+}\r
+CCrashReport crasher("tortoisegit-bug@googlegroups.com", "Crash Report for TortoiseGit " APP_X64_STRING " : " STRPRODUCTVER, TRUE);// crash\r
\r
// CTortoiseProcApp initialization\r
\r
CheckUpgrade();\r
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));\r
CMFCButton::EnableWindowsTheming();\r
+\r
+ if(!CheckMsysGitDir())\r
+ {\r
+ if(CMessageBox::Show(NULL,_T("MSysGit(http://code.google.com/p/msysgit) have not installed Correctly\n\\r
+or MSysGit Path setting error\n\\r
+Click Yes to open setting dialog to setup MSysGit Path"),\r
+ _T("TortoiseGit"),MB_YESNO|MB_ICONERROR)==IDYES);\r
+ {\r
+ //todo open setting\r
+ }\r
+ return FALSE; \r
+ }\r
+\r
//set the resource dll for the required language\r
CRegDWORD loc = CRegDWORD(_T("Software\\TortoiseGit\\LanguageID"), 1033);\r
long langId = loc;\r
break;\r
}\r
\r
+ if(g_Git.m_CurrentDir)\r
+ SetCurrentDirectory(g_Git.m_CurrentDir);\r
+\r
cmd->SetParser(parser);\r
cmd->SetPaths(pathList, cmdLinePath);\r
\r