Commit 37640067 authored by camilo higuita's avatar camilo higuita

when opneing external urls check local file path

parent be9d6dba
Pipeline #6565 failed with stage
in 23 minutes and 29 seconds
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include <QFileInfo> #include <QFileInfo>
#include <QDir> #include <QDir>
#include <QDebug> #include <QDebug>
#include <QUrl>
Index::Index(QObject *parent) : QObject(parent) {} Index::Index(QObject *parent) : QObject(parent) {}
...@@ -10,12 +11,14 @@ void Index::openPaths(const QStringList &paths) ...@@ -10,12 +11,14 @@ void Index::openPaths(const QStringList &paths)
{ {
emit this->openPath(std::accumulate(paths.constBegin(), paths.constEnd(), QStringList(), [](QStringList &list, const QString &path) -> QStringList emit this->openPath(std::accumulate(paths.constBegin(), paths.constEnd(), QStringList(), [](QStringList &list, const QString &path) -> QStringList
{ {
const QFileInfo file(path); const auto url = QUrl::fromLocalFile(path);
if(file.isDir())
list << path;
else
list << file.dir().absolutePath();
return list; const QFileInfo file(url.toLocalFile());
})); if(file.isDir())
list << url.toString();
else
list << QUrl::fromLocalFile(file.dir().absolutePath()).toString();
return list;
}));
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment