This commit is contained in:
Birunthan Mohanathas 2012-06-10 13:14:49 +03:00
parent 5c90577955
commit cbb2c8f5c5
2 changed files with 6 additions and 9 deletions

View File

@ -1165,8 +1165,7 @@ void CSystem::SetWallpaper(const std::wstring& wallpaper, const std::wstring& st
Bitmap* bitmap = Bitmap::FromFile(wallpaper.c_str()); Bitmap* bitmap = Bitmap::FromFile(wallpaper.c_str());
if (bitmap && bitmap->GetLastStatus() == Ok) if (bitmap && bitmap->GetLastStatus() == Ok)
{ {
std::wstring file = Rainmeter->GetSettingsPath(); std::wstring file = Rainmeter->GetSettingsPath() + L"Wallpaper.bmp";
file += L"Wallpaper.bmp";
const CLSID bmpClsid = { 0x557cf400, 0x1a04, 0x11d3, { 0x9a, 0x73, 0x0, 0x0, 0xf8, 0x1e, 0xf3, 0x2e } }; const CLSID bmpClsid = { 0x557cf400, 0x1a04, 0x11d3, { 0x9a, 0x73, 0x0, 0x0, 0xf8, 0x1e, 0xf3, 0x2e } };
if (bitmap->Save(file.c_str(), &bmpClsid) == Ok) if (bitmap->Save(file.c_str(), &bmpClsid) == Ok)
@ -1273,18 +1272,16 @@ bool CSystem::RemoveFile(const std::wstring& file)
** Recursively removes folder. ** Recursively removes folder.
** **
*/ */
bool CSystem::RemoveFolder(const std::wstring& strFolder) bool CSystem::RemoveFolder(std::wstring folder)
{ {
std::wstring tmpFolder(strFolder);
// The strings must end with double nul // The strings must end with double nul
tmpFolder.append(1, L'\0'); folder.append(1, L'\0');
SHFILEOPSTRUCT fo = SHFILEOPSTRUCT fo =
{ {
NULL, NULL,
FO_DELETE, FO_DELETE,
tmpFolder.c_str(), folder.c_str(),
NULL, NULL,
FOF_NO_UI | FOF_NOCONFIRMATION | FOF_ALLOWUNDO FOF_NO_UI | FOF_NOCONFIRMATION | FOF_ALLOWUNDO
}; };
@ -1292,7 +1289,7 @@ bool CSystem::RemoveFolder(const std::wstring& strFolder)
int result = SHFileOperation(&fo); int result = SHFileOperation(&fo);
if (result != 0) if (result != 0)
{ {
LogWithArgs(LOG_ERROR, L"Unable to delete folder %s (%i)", strFolder.c_str(), result); LogWithArgs(LOG_ERROR, L"Unable to delete folder %s (%i)", folder.c_str(), result);
return false; return false;
} }
return true; return true;

View File

@ -84,7 +84,7 @@ public:
static bool CopyFiles(std::wstring from, std::wstring to, bool bMove = false); static bool CopyFiles(std::wstring from, std::wstring to, bool bMove = false);
static bool RemoveFile(const std::wstring& file); static bool RemoveFile(const std::wstring& file);
static bool RemoveFolder(const std::wstring& strFolder); static bool RemoveFolder(std::wstring folder);
static void UpdateIniFileMappingList(); static void UpdateIniFileMappingList();
static std::wstring GetTemporaryFile(const std::wstring& iniFile); static std::wstring GetTemporaryFile(const std::wstring& iniFile);