diff --git a/openbr/openbr_plugin.cpp b/openbr/openbr_plugin.cpp index 50b3b6b..61b760c 100644 --- a/openbr/openbr_plugin.cpp +++ b/openbr/openbr_plugin.cpp @@ -112,7 +112,17 @@ QList File::split(const QString &separator) const QString File::resolved() const { - return exists() ? name : Globals->path + "/" + name; + if (exists()) return name; + QStringList paths = get("path").split(";", QString::SkipEmptyParts); + foreach (const QString &path, paths) { + const File resolved = path + "/" + name; + if (resolved.exists()) return resolved; + } + foreach (const QString &path, paths) { + const File resolved = path + "/" + fileName(); + if (resolved.exists()) return resolved; + } + return name; } bool File::contains(const QString &key) const diff --git a/openbr/openbr_plugin.h b/openbr/openbr_plugin.h index 589531f..e5290b4 100644 --- a/openbr/openbr_plugin.h +++ b/openbr/openbr_plugin.h @@ -550,6 +550,7 @@ public: /*! * \brief Path to use when resolving images specified with relative paths. + * Multiple paths can be specified using a semicolon separator. */ Q_PROPERTY(QString path READ get_path WRITE set_path RESET reset_path) BR_PROPERTY(QString, path, "") diff --git a/openbr/plugins/format.cpp b/openbr/plugins/format.cpp index 048ed13..bdd839b 100644 --- a/openbr/plugins/format.cpp +++ b/openbr/plugins/format.cpp @@ -205,19 +205,7 @@ class DefaultFormat : public Format t = url->read(); } } else { - QString fileName = file.name; - if (!QFileInfo(fileName).exists()) { - fileName = file.get("path") + "/" + file.name; - if (!QFileInfo(fileName).exists()) { - fileName = file.fileName(); - if (!QFileInfo(fileName).exists()) { - fileName = file.get("path") + "/" + file.fileName(); - if (!QFileInfo(fileName).exists()) return t; - } - } - } - - Mat m = imread(fileName.toStdString()); + Mat m = imread(file.resolved().toStdString()); if (m.data) { t.append(m); } else {