aboutsummaryrefslogtreecommitdiffstats
path: root/qthelper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qthelper.cpp')
-rw-r--r--qthelper.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/qthelper.cpp b/qthelper.cpp
index 6e3c957a6..06a6610f0 100644
--- a/qthelper.cpp
+++ b/qthelper.cpp
@@ -627,6 +627,28 @@ extern "C" const char *system_default_directory(void)
return filename;
}
+extern "C" char *move_away(const char *old_path)
+{
+ if (verbose > 1)
+ qDebug() << "move away" << old_path;
+ QFile oldFile(old_path);
+ QFile newFile;
+ QString newPath;
+ int i = 0;
+ do {
+ newPath = QString(old_path) + QString(".%1").arg(++i);
+ newFile.setFileName(newPath);
+ } while(newFile.exists());
+ if (verbose > 1)
+ qDebug() << "renaming to" << newPath;
+ if (!oldFile.rename(newPath)) {
+ qDebug() << "rename of" << old_path << "to" << newPath << "failed";
+ return strdup("");
+ }
+ return strdup(qPrintable(newPath));
+
+}
+
extern "C" char *get_file_name(const char *fileName)
{
QFileInfo fileInfo(fileName);
@@ -1354,7 +1376,8 @@ int getCloudURL(QString &filename)
prefs.cloud_storage_email_encoded = strdup(qPrintable(email));
}
filename = QString(QString(prefs.cloud_git_url) + "/%1[%1]").arg(email);
- qDebug() << "cloud URL set as" << filename;
+ if (verbose)
+ qDebug() << "cloud URL set as" << filename;
return 0;
}