summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/main.cpp b/main.cpp
index 854276e..db818e6 100644
--- a/main.cpp
+++ b/main.cpp
@@ -245,14 +245,32 @@ bool parseConfigFileDirectory(Config *config, const QString &dirName)
static bool removeDefault()
{
- if (QFile::exists(B2QT_PREFIX)) {
+ QFileInfo fi(B2QT_PREFIX);
+
+ if (fi.isSymLink()) {
if (!QFile::remove(B2QT_PREFIX)) {
fprintf(stderr, "Could not remove default application.\n");
return false;
}
sync();
+ return true;
}
- return true;
+
+ if (fi.isDir()) {
+ fprintf(stderr, "Could not remove default application because '" B2QT_PREFIX "' is a directory. It should be a symlink.\n");
+ return false;
+ }
+
+ if (fi.isFile()) {
+ fprintf(stderr, "Could not remove default application because '" B2QT_PREFIX "' is a file. It should be a symlink.\n");
+ return false;
+ }
+
+ if (!fi.exists()) {
+ return true;
+ }
+
+ return false;
}
static bool makeDefault(const QString &filepath)