aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarald Sitter <[email protected]>2017-03-30 14:35:32 +0200
committerHarald Sitter <[email protected]>2017-03-30 14:35:32 +0200
commita137784a963ebe370f1c4d4f010ebb280a08b5df (patch)
treef0a3939019c02803527de885eee990514451548d
parent33642d43faba9f4f642b2af27de03b6cafb863e5 (diff)
port away from access() usage in openURL
we have no performance concerns there. this is run once when the user inputs or selects a URI, using libc functions here serves no purpose really
-rw-r--r--src/mainWindow.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/mainWindow.cpp b/src/mainWindow.cpp
index 5e608cc..4f98b37 100644
--- a/src/mainWindow.cpp
+++ b/src/mainWindow.cpp
@@ -32,7 +32,6 @@
#include "summaryWidget.h"
#include <cstdlib> //std::exit()
-#include <unistd.h> //access()
#include <iostream>
#include <KActionCollection>
@@ -366,7 +365,6 @@ bool MainWindow::openUrl(const QUrl &u)
QUrl uri = u.adjusted(QUrl::NormalizePathSegments);
const QString path = uri.path();
- const QByteArray path8bit = QFile::encodeName(path);
const bool isLocal = uri.isLocalFile();
if (uri.isEmpty())
@@ -381,11 +379,11 @@ bool MainWindow::openUrl(const QUrl &u)
{
KMSG(i18n("Filelight only accepts absolute paths, eg. /%1", path));
}
- else if (isLocal && access(path8bit, F_OK) != 0) //stat(path, &statbuf) == 0
+ else if (isLocal && !QDir(path).exists())
{
KMSG(i18n("Folder not found: %1", path));
}
- else if (isLocal && !QDir(path).isReadable()) //access(path8bit, R_OK | X_OK) != 0 doesn't work on win32
+ else if (isLocal && !QDir(path).isReadable())
{
KMSG(i18n("Unable to enter: %1\nYou do not have access rights to this location.", path));
}