Install firmware and waveforms under /usr/share on Linux

Skip installing the .exe and .bat files on Linux.

Other platforms could also search QStandardPaths::AppDataLocation but I
am not familiar with how they are packaged.  The locations searched
corresponds to $XDG_DATA_DIRS; prepend the right path to it when running
from the AppImage container.
This commit is contained in:
Kyle Guinn 2021-11-09 19:13:04 -06:00
parent 5ba50892e9
commit 73df20a429
5 changed files with 31 additions and 8 deletions

View File

@ -164,12 +164,14 @@ unix:!android:!macx{
}
}
other.files += bin/firmware
other.files += bin/waveforms
other.path = /usr/bin/EspoTek-Labrador
target.path = /usr/bin/EspoTek-Labrador
firmware.files += $$files(bin/firmware/labrafirm*)
firmware.path = /usr/share/EspoTek/Labrador/firmware
waveforms.files += $$files(bin/waveforms/*)
waveforms.path = /usr/share/EspoTek/Labrador/waveforms
udev.path = /etc/udev/rules.d
udev.files = rules.d/69-labrador.rules
@ -196,13 +198,13 @@ unix:!android:!macx{
}
equals(APPIMAGE, 1){
other.path = /usr/bin
target.path = /usr/bin
}
INSTALLS += target
INSTALLS += lib_deploy
INSTALLS += other
INSTALLS += firmware
INSTALLS += waveforms
INSTALLS += udev
INSTALLS += icon48
INSTALLS += icon256

View File

@ -1,5 +1,6 @@
#include "functiongencontrol.h"
#include "platformspecific.h"
#include <QStandardPaths>
namespace functionGen {
@ -9,9 +10,13 @@ ChannelData const& SingleChannelController::getData() const {
void SingleChannelController::waveformName(QString newName)
{
#ifdef PLATFORM_ANDROID
#if defined(PLATFORM_ANDROID)
QString path("assets:/waveforms/");
QFile file(path.append(newName).append(".tlw"));
#elif defined(PLATFORM_LINUX)
QString path("waveforms/");
path.append(newName).append(".tlw");
QFile file(QStandardPaths::locate(QStandardPaths::AppDataLocation, path));
#else
QString path = QCoreApplication::applicationDirPath();
QFile file(path.append("/waveforms/").append(newName).append(".tlw"));

View File

@ -41,6 +41,8 @@ if [ -n "$cxxpath" ] || [ -n "$gccpath" ]; then
export LD_LIBRARY_PATH="${cxxpath}${gccpath}${LD_LIBRARY_PATH}"
fi
export XDG_DATA_DIRS="$HERE/usr/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
if [ ! -f /etc/udev/rules.d/69-labrador.rules ]; then
cat > /tmp/roothelper <<\EOoF
#!/bin/bash

View File

@ -1,4 +1,5 @@
#include "espocombobox.h"
#include <QStandardPaths>
espoComboBox::espoComboBox(QWidget *parent) : QComboBox(parent)
{
@ -7,8 +8,10 @@ espoComboBox::espoComboBox(QWidget *parent) : QComboBox(parent)
void espoComboBox::readWaveformList(void)
{
#ifdef PLATFORM_ANDROID
#if defined(PLATFORM_ANDROID)
QFile file("assets:/waveforms/_list.wfl");
#elif defined(PLATFORM_LINUX)
QFile file(QStandardPaths::locate(QStandardPaths::AppDataLocation, "waveforms/_list.wfl"));
#else
QString path = QCoreApplication::applicationDirPath();
QFile file(path.append("/waveforms/_list.wfl"));

View File

@ -4,6 +4,7 @@
#endif
#include <QApplication>
#include <QMessageBox>
#include <QStandardPaths>
unixUsbDriver::unixUsbDriver(QWidget *parent) : genericUsbDriver(parent)
{
@ -350,8 +351,13 @@ int unixUsbDriver::flashFirmware(void){
qDebug() << "BA94 closed";
//Get location of firmware file
#ifdef PLATFORM_LINUX
QString dirString = QString::asprintf("firmware/labrafirm_%04x_%02x.hex", EXPECTED_FIRMWARE_VERSION, DEFINED_EXPECTED_VARIANT);
dirString = QStandardPaths::locate(QStandardPaths::AppDataLocation, dirString);
#else
QString dirString = QCoreApplication::applicationDirPath();
dirString.append(QString::asprintf("/firmware/labrafirm_%04x_%02x.hex", EXPECTED_FIRMWARE_VERSION, DEFINED_EXPECTED_VARIANT));
#endif
qDebug() << "FLASHING " << dirString;
//Set up interface to dfuprog
@ -410,8 +416,13 @@ int unixUsbDriver::flashFirmware(void){
void unixUsbDriver::manualFirmwareRecovery(void){
#ifndef PLATFORM_ANDROID
//Get location of firmware file
#ifdef PLATFORM_LINUX
QString dirString = QString::asprintf("firmware/labrafirm_%04x_%02x.hex", EXPECTED_FIRMWARE_VERSION, DEFINED_EXPECTED_VARIANT);
dirString = QStandardPaths::locate(QStandardPaths::AppDataLocation, dirString);
#else
QString dirString = QCoreApplication::applicationDirPath();
dirString.append(QString::asprintf("/firmware/labrafirm_%04x_%02x.hex", EXPECTED_FIRMWARE_VERSION, DEFINED_EXPECTED_VARIANT));
#endif
//Vars
QMessageBox manualFirmwareMessages;