summaryrefslogtreecommitdiffstats
path: root/qthelper.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-09-26 12:34:38 -0400
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-09-26 12:34:38 -0400
commitb1dca1176f567318759f03e3a34e5c1628f07e9e (patch)
treeb0357af26ca6750febb46b0bec095e8a6c78fdbe /qthelper.cpp
parentaa76f74f9743d31238429d6d9cd1a2e897923971 (diff)
downloadsubsurface-b1dca1176f567318759f03e3a34e5c1628f07e9e.tar.gz
Cloud storage: use QDir instead of QFile for renaming directories
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qthelper.cpp')
-rw-r--r--qthelper.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/qthelper.cpp b/qthelper.cpp
index 06a6610f0..c316481f2 100644
--- a/qthelper.cpp
+++ b/qthelper.cpp
@@ -631,22 +631,22 @@ extern "C" char *move_away(const char *old_path)
{
if (verbose > 1)
qDebug() << "move away" << old_path;
- QFile oldFile(old_path);
- QFile newFile;
+ QDir oldDir(old_path);
+ QDir newDir;
QString newPath;
int i = 0;
do {
newPath = QString(old_path) + QString(".%1").arg(++i);
- newFile.setFileName(newPath);
- } while(newFile.exists());
+ newDir.setPath(newPath);
+ } while(newDir.exists());
if (verbose > 1)
qDebug() << "renaming to" << newPath;
- if (!oldFile.rename(newPath)) {
- qDebug() << "rename of" << old_path << "to" << newPath << "failed";
+ if (!oldDir.rename(old_path, newPath)) {
+ if (verbose)
+ qDebug() << "rename of" << old_path << "to" << newPath << "failed";
return strdup("");
}
return strdup(qPrintable(newPath));
-
}
extern "C" char *get_file_name(const char *fileName)