This commit is contained in:
Birunthan Mohanathas 2012-05-30 08:10:12 +03:00
parent 659cb563bd
commit 0891ee4b91
3 changed files with 9 additions and 11 deletions

View File

@ -254,7 +254,7 @@ const WCHAR* CMeasure::CheckSubstitute(const WCHAR* buffer)
if (re == NULL) if (re == NULL)
{ {
MakePlainSubstitute(str, i); MakePlainSubstitute(str, i);
LogWithArgs(LOG_NOTICE, L"%S", error); LogWithArgs(LOG_NOTICE, L"Substitute: %S", error);
} }
else else
{ {

View File

@ -1230,27 +1230,25 @@ void CSystem::SetWallpaper(const std::wstring& wallpaper, const std::wstring& st
** Copies files and folders from one location to another. ** Copies files and folders from one location to another.
** **
*/ */
bool CSystem::CopyFiles(const std::wstring& strFrom, const std::wstring& strTo, bool bMove) bool CSystem::CopyFiles(std::wstring from, std::wstring to, bool bMove)
{ {
std::wstring tmpFrom(strFrom), tmpTo(strTo); // The strings must end with double \0
from.append(1, L'\0');
// The strings must end with double nul to.append(1, L'\0');
tmpFrom.append(1, L'\0');
tmpTo.append(1, L'\0');
SHFILEOPSTRUCT fo = SHFILEOPSTRUCT fo =
{ {
NULL, NULL,
bMove ? FO_MOVE : FO_COPY, bMove ? FO_MOVE : FO_COPY,
tmpFrom.c_str(), from.c_str(),
tmpTo.c_str(), to.c_str(),
FOF_NO_UI | FOF_NOCONFIRMATION | FOF_ALLOWUNDO FOF_NO_UI | FOF_NOCONFIRMATION | FOF_ALLOWUNDO
}; };
int result = SHFileOperation(&fo); int result = SHFileOperation(&fo);
if (result != 0) if (result != 0)
{ {
LogWithArgs(LOG_ERROR, L"Unable to copy files from %s to %s (%i)", strFrom.c_str(), strTo.c_str(), result); LogWithArgs(LOG_ERROR, L"Copy error: From %s to %s (%i)", from.c_str(), to.c_str(), result);
return false; return false;
} }
return true; return true;

View File

@ -82,7 +82,7 @@ public:
static void SetClipboardText(const std::wstring& text); static void SetClipboardText(const std::wstring& text);
static void SetWallpaper(const std::wstring& wallpaper, const std::wstring& style); static void SetWallpaper(const std::wstring& wallpaper, const std::wstring& style);
static bool CopyFiles(const std::wstring& strFrom, const std::wstring& strTo, 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(const std::wstring& strFolder);