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.

This commit is contained in:
Rom Walton 2014-01-28 21:54:43 -05:00
parent c4f4421ff0
commit 41a8b26117
1 changed files with 9 additions and 0 deletions

View File

@ -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