OSDN Git Service

Fix Crash Problem When TortoiseGit Install before Msysgit.
[tortoisegit/TortoiseGitJp.git] / src / Git / Git.cpp
index bf220cd..febd592 100644 (file)
@@ -108,6 +108,41 @@ static BOOL FindGitPath()
 #define MAX_DIRBUFFER 1000\r
 CString CGit::ms_LastMsysGitDir;\r
 CGit g_Git;\r
+BOOL g_IsWingitDllload = TRUE;\r
+\r
+LPBYTE wgGetRevisionID_safe(const char *pszProjectPath, const char *pszName)\r
+{\r
+       if(g_IsWingitDllload)\r
+               return wgGetRevisionID(pszProjectPath,pszName);\r
+       else\r
+               return NULL;\r
+}\r
+\r
+BOOL wgEnumFiles_safe(const char *pszProjectPath, const char *pszSubPath, unsigned int nFlags, WGENUMFILECB *pEnumCb, void *pUserData)\r
+{\r
+       if(g_IsWingitDllload)\r
+               return wgEnumFiles(pszProjectPath,pszSubPath,nFlags,pEnumCb,pUserData);\r
+       else\r
+               return FALSE;\r
+}\r
+\r
+static void InitWinGitDll()\r
+{\r
+       __try\r
+       {\r
+\r
+               if ( !wgInit() )\r
+               {\r
+                               // TODO\r
+               }\r
+       }\r
+       __except(1)\r
+       {\r
+               g_IsWingitDllload=FALSE;\r
+               return;\r
+       }\r
+\r
+}\r
 CGit::CGit(void)\r
 {\r
        GetCurrentDirectory(MAX_DIRBUFFER,m_CurrentDir.GetBuffer(MAX_DIRBUFFER));\r
@@ -117,11 +152,7 @@ CGit::CGit(void)
        {\r
                // TODO\r
        }\r
-\r
-       if ( !wgInit() )\r
-       {\r
-               // TODO\r
-       }\r
+       InitWinGitDll();\r
 }\r
 \r
 CGit::~CGit(void)\r