Cloud storage: try to work around weird Windows rename issue

In some cases the rename of the cache directory would fail in my testing.
Based on code that Lubomir provided, this tries a Windows specific
implementation of folder rename if the QDir based one fails for some
reason - but obviously only if we are running on Windows.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-09-26 12:35:21 -04:00
parent b1dca1176f
commit 8e76456149
3 changed files with 51 additions and 1 deletions

View file

@ -644,7 +644,12 @@ extern "C" char *move_away(const char *old_path)
if (!oldDir.rename(old_path, newPath)) {
if (verbose)
qDebug() << "rename of" << old_path << "to" << newPath << "failed";
return strdup("");
// this next one we only try on Windows... if we are on a different platform
// we simply give up and return an empty string
#ifdef WIN32
if (subsurface_dir_rename(old_path, qPrintable(newPath)) == 0)
#endif
return strdup("");
}
return strdup(qPrintable(newPath));
}