From 7633c5dc49fbf59e32e366d5ae062375b8562f72 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Thu, 31 Jan 2013 16:47:15 +0100 Subject: [PATCH] Detect msysgit installation with user-rights Signed-off-by: Sven Strickroth --- src/Git/Git.cpp | 10 ++++++++-- src/Git/GitConfig.h | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Git/Git.cpp b/src/Git/Git.cpp index f6b2d950d..f751e96a5 100644 --- a/src/Git/Git.cpp +++ b/src/Git/Git.cpp @@ -1691,9 +1691,15 @@ BOOL CGit::CheckMsysGitDir() str=msysdir; if(str.IsEmpty() || !FileExists(str + _T("\\git.exe"))) { - CRegString msysinstalldir=CRegString(REG_MSYSGIT_INSTALL,_T(""),FALSE,HKEY_LOCAL_MACHINE); - str=msysinstalldir; + CRegString msyslocalinstalldir = CRegString(REG_MSYSGIT_INSTALL32, _T(""), FALSE, HKEY_CURRENT_USER); + str = msyslocalinstalldir; str.TrimRight(_T("\\")); + if (str.IsEmpty()) + { + CRegString msysinstalldir = CRegString(REG_MSYSGIT_INSTALL, _T(""), FALSE, HKEY_LOCAL_MACHINE); + str = msysinstalldir; + str.TrimRight(_T("\\")); + } if ( !str.IsEmpty() ) { str += "\\bin"; diff --git a/src/Git/GitConfig.h b/src/Git/GitConfig.h index 4c1ce872b..150272335 100644 --- a/src/Git/GitConfig.h +++ b/src/Git/GitConfig.h @@ -1,6 +1,6 @@ // TortoiseGit - a Windows shell extension for easy version control -// Copyright (C) 2008-2011 - TortoiseGit +// Copyright (C) 2008-2011,2013 - TortoiseGit // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -32,5 +32,6 @@ public: #ifndef WIN64 #define REG_MSYSGIT_INSTALL _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Git_is1\\InstallLocation") #else +#define REG_MSYSGIT_INSTALL32 _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Git_is1\\InstallLocation") #define REG_MSYSGIT_INSTALL _T("SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Git_is1\\InstallLocation") #endif \ No newline at end of file -- 2.11.4.GIT