Minor tweaks.

This commit is contained in:
spx
2011-11-24 00:30:56 +00:00
parent 2c5d592cd8
commit 02f2d51b41
5 changed files with 122 additions and 95 deletions

View File

@ -3182,16 +3182,17 @@ void CRainmeter::ExpandEnvironmentVariables(std::wstring& strPath)
HRESULT hr = SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, buffer);
if (SUCCEEDED(hr))
{
std::wstring path = buffer;
size_t len = wcslen(buffer);
do
{
strPath.replace(pos, 9, path);
strPath.replace(pos, 9, buffer, len);
}
while ((pos = strPath.find(L"%APPDATA%", pos + path.length())) != std::wstring::npos);
while ((pos = strPath.find(L"%APPDATA%", pos + len)) != std::wstring::npos);
}
}
if (strPath.find(L'%') != std::wstring::npos)
if ((pos = strPath.find(L'%')) != std::wstring::npos &&
strPath.find(L'%', pos + 2) != std::wstring::npos)
{
// Expand the environment variables
do