From 41a8b26117d9ac5959b9fdf2288959face0c6461 Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Tue, 28 Jan 2014 21:54:43 -0500 Subject: [PATCH] MGR: If the DATADIR registry entry is missing, check to see if the data directory exists at the default location. If so, use it over the current directory. --- clientgui/BOINCGUIApp.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/clientgui/BOINCGUIApp.cpp b/clientgui/BOINCGUIApp.cpp index 9011d3cfaa..e5e0e6b415 100644 --- a/clientgui/BOINCGUIApp.cpp +++ b/clientgui/BOINCGUIApp.cpp @@ -744,6 +744,7 @@ void CBOINCGUIApp::DetectDataDirectory() { LONG lReturnValue; HKEY hkSetupHive; LPTSTR lpszRegistryValue = NULL; + TCHAR szPath[MAX_PATH]; DWORD dwSize = 0; // change the current directory to the boinc data directory if it exists @@ -782,6 +783,14 @@ void CBOINCGUIApp::DetectDataDirectory() { // Store the root directory for later use. m_strBOINCMGRDataDirectory = lpszRegistryValue; } + } else { + if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_COMMON_APPDATA|CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, szPath))) { + _tcsncat(szPath, _T("\\boinc"), ((sizeof(szPath)/sizeof(TCHAR)) - _tcslen(szPath))); + if (wxFile::Exists(szPath)) { + // Store the root directory for later use. + m_strBOINCMGRDataDirectory = szPath; + } + } } // Cleanup