]> sigrok.org Git - pulseview.git/commitdiff
android: Check for firmware in standard locations, too
authorDaniel Elstner <redacted>
Thu, 1 Oct 2015 12:59:03 +0000 (14:59 +0200)
committerDaniel Elstner <redacted>
Thu, 1 Oct 2015 12:59:03 +0000 (14:59 +0200)
android/assetreader.cpp

index bf76704a8b873f724f526ab773e62c4a46562f7b..f14e7b65117933b5a153c0cf704e2af5dad191fb 100644 (file)
@@ -22,6 +22,7 @@
 #include <memory>
 #include <QtCore/QDebug>
 #include <QtCore/QFile>
+#include <QtCore/QStandardPaths>
 
 using namespace pv;
 
@@ -31,7 +32,11 @@ AndroidAssetReader::~AndroidAssetReader()
 void AndroidAssetReader::open(struct sr_resource *res, std::string name)
 {
        if (res->type == SR_RESOURCE_FIRMWARE) {
-               const auto path = QString::fromStdString("assets:/sigrok-firmware/" + name);
+               auto path = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
+                                                  QString::fromStdString("sigrok-firmware/" + name));
+               if (path.isEmpty())
+                       path = QString::fromStdString("assets:/sigrok-firmware/" + name);
+
                std::unique_ptr<QFile> file {new QFile{path}};
 
                if (!file->open(QIODevice::ReadOnly))