summaryrefslogtreecommitdiffstats
path: root/qthelper.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-09-26 12:35:21 -0400
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-09-26 12:35:21 -0400
commit8e7645614928ddd90a4bc9cc89d4f2f7fc5d7ea8 (patch)
tree6618105b15cd9fdfe2d21452332e8888968e5e60 /qthelper.cpp
parentb1dca1176f567318759f03e3a34e5c1628f07e9e (diff)
downloadsubsurface-8e7645614928ddd90a4bc9cc89d4f2f7fc5d7ea8.tar.gz
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>
Diffstat (limited to 'qthelper.cpp')
-rw-r--r--qthelper.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/qthelper.cpp b/qthelper.cpp
index c316481f2..31ec43df7 100644
--- a/qthelper.cpp
+++ b/qthelper.cpp
@@ -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));
}