Add env-var XDG_RUNTIME_DIR
This commit is contained in:
parent
de75ef32d9
commit
71a6b82d58
26
main.cpp
26
main.cpp
@ -5,7 +5,6 @@
|
|||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
|
||||||
#include "message_handler.h"
|
#include "message_handler.h"
|
||||||
|
|
||||||
#include "interfaces.h"
|
#include "interfaces.h"
|
||||||
#include "DCPlugin/include/hwapi.h"
|
#include "DCPlugin/include/hwapi.h"
|
||||||
|
|
||||||
@ -15,6 +14,7 @@
|
|||||||
#include <QSharedMemory>
|
#include <QSharedMemory>
|
||||||
#include <QRunnable>
|
#include <QRunnable>
|
||||||
#include <QThreadPool>
|
#include <QThreadPool>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
#include "update.h"
|
#include "update.h"
|
||||||
|
|
||||||
@ -26,12 +26,16 @@
|
|||||||
|
|
||||||
class Work : public QRunnable {
|
class Work : public QRunnable {
|
||||||
QString m_update_ctrl_file;
|
QString m_update_ctrl_file;
|
||||||
|
QString m_workingDir;
|
||||||
public:
|
public:
|
||||||
explicit Work(QString update_ctrl_file)
|
explicit Work(QString update_ctrl_file, QString workingDir)
|
||||||
: m_update_ctrl_file(update_ctrl_file) {}
|
: m_update_ctrl_file(update_ctrl_file)
|
||||||
|
, m_workingDir(workingDir) {
|
||||||
|
}
|
||||||
void run() {
|
void run() {
|
||||||
Update m_update(m_update_ctrl_file);
|
Update m_update(m_update_ctrl_file, m_workingDir);
|
||||||
m_update.doUpdate();
|
// if (m_update.doUpdate()) {
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -45,13 +49,15 @@ int main(int argc, char *argv[]) {
|
|||||||
//setDebugLevel(QtMsgType::QtDebugMsg);
|
//setDebugLevel(QtMsgType::QtDebugMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString update_ctrl_file = "/opt/app/tools/atbupdate/update_log.csv";
|
QByteArray const value = qgetenv("XDG_RUNTIME_DIR");
|
||||||
if (argc == 2) {
|
if (value.size() == 0) {
|
||||||
update_ctrl_file = argv[1];
|
qputenv("XDG_RUNTIME_DIR", "/run/user/0");
|
||||||
}
|
}
|
||||||
qInfo() << "Using" << update_ctrl_file << "as update logfile";
|
|
||||||
|
|
||||||
Work work(update_ctrl_file);
|
QString const update_ctrl_file = "/opt/app/tools/atbupdate/update_log.csv";
|
||||||
|
QString const workingDir = (argc == 2) ? argv[1] : ".";
|
||||||
|
|
||||||
|
Work work(update_ctrl_file, workingDir);
|
||||||
work.setAutoDelete(false);
|
work.setAutoDelete(false);
|
||||||
QThreadPool *threadPool = QThreadPool::globalInstance();
|
QThreadPool *threadPool = QThreadPool::globalInstance();
|
||||||
threadPool->start(&work);
|
threadPool->start(&work);
|
||||||
|
Loading…
Reference in New Issue
Block a user