Merge branch '0.4.x' into 0.5.0.x

This commit is contained in:
Luke Dashjr
2012-03-03 13:59:19 -05:00
9 changed files with 87 additions and 27 deletions

View File

@@ -737,26 +737,35 @@ string MyGetSpecialFolderPath(int nFolder, bool fCreate)
{
PSHGETSPECIALFOLDERPATHA pSHGetSpecialFolderPath =
(PSHGETSPECIALFOLDERPATHA)GetProcAddress(hShell32, "SHGetSpecialFolderPathA");
bool fSuccess = false;
if (pSHGetSpecialFolderPath)
fSuccess =
(*pSHGetSpecialFolderPath)(NULL, pszPath, nFolder, fCreate);
FreeModule(hShell32);
if (fSuccess)
return pszPath;
}
// Backup option
if (pszPath[0] == '\0')
std::string strPath;
{
const char *pszEnv;
if (nFolder == CSIDL_STARTUP)
{
strcpy(pszPath, getenv("USERPROFILE"));
strcat(pszPath, "\\Start Menu\\Programs\\Startup");
pszEnv = getenv("USERPROFILE");
if (pszEnv)
strPath = pszEnv;
strPath += "\\Start Menu\\Programs\\Startup";
}
else if (nFolder == CSIDL_APPDATA)
{
strcpy(pszPath, getenv("APPDATA"));
pszEnv = getenv("APPDATA");
if (pszEnv)
strPath = pszEnv;
}
}
return pszPath;
return strPath;
}
#endif