Skip to content

Commit

Permalink
Fixed that copy operation fails on XP if from path ends with path sep…
Browse files Browse the repository at this point in the history
…arator
  • Loading branch information
spx268 committed Mar 18, 2013
1 parent 5d6794c commit 5252c95
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Library/System.cpp
Expand Up @@ -1216,6 +1216,13 @@ void CSystem::SetWallpaper(const std::wstring& wallpaper, const std::wstring& st
*/ */
bool CSystem::CopyFiles(std::wstring from, std::wstring to, bool bMove) bool CSystem::CopyFiles(std::wstring from, std::wstring to, bool bMove)
{ {
// If given "from" path ends with path separator, remove it (Workaround for XP: error code 1026)
size_t len;
while (len = from.size(), len > 0 && IsPathSeparator(from[len - 1]))
{
from.resize(len - 1);
}

// The strings must end with double \0 // The strings must end with double \0
from.append(1, L'\0'); from.append(1, L'\0');
to.append(1, L'\0'); to.append(1, L'\0');
Expand Down

0 comments on commit 5252c95

Please sign in to comment.