Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
82751eb1d4 | |||
17a4a69df2 | |||
a03261d04a |
@@ -15,7 +15,7 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
VERSION=1.3.3
|
||||
VERSION=1.3.4
|
||||
|
||||
INCLUDEPATH += plugins
|
||||
|
||||
|
@@ -14,9 +14,9 @@
|
||||
#include <QRegExp>
|
||||
#include <QApplication>
|
||||
|
||||
//#include <iostream>
|
||||
//#include <fstream>
|
||||
//#include <ctime>
|
||||
#if defined (Q_OS_UNIX) || defined (Q_OS_LINUX)
|
||||
#include "unistd.h"
|
||||
#endif
|
||||
|
||||
#include "plugins/interfaces.h"
|
||||
|
||||
@@ -742,6 +742,9 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
||||
|
||||
QString const &parentName = Utils::getParentName();
|
||||
|
||||
Utils::printInfoMsg(
|
||||
QString("PARENT OF ATB-UPDATE-TOOL (ppid=%1) ").arg(getppid()) + parentName);
|
||||
|
||||
if (parentName == "ATBQT" || parentName == "systemd") {
|
||||
// the tool was not called during 'service' ot during an automatic
|
||||
// update procedure. and it was called explicitly with libCAmaster.so
|
||||
|
24
utils.cpp
24
utils.cpp
@@ -2,7 +2,10 @@
|
||||
#include "message_handler.h"
|
||||
#include "git/git_client.h"
|
||||
|
||||
|
||||
#if defined (Q_OS_UNIX) || defined (Q_OS_LINUX)
|
||||
#include "unistd.h"
|
||||
#endif
|
||||
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
@@ -180,18 +183,15 @@ bool Utils::sameFilesInDirs(QDir const &dir1, QDir const &dir2,
|
||||
|
||||
QString Utils::getParentName() { // get name of parent process
|
||||
QString ppid = QString("/proc/%1/status").arg(getppid());
|
||||
QFile f(ppid);
|
||||
if (f.exists()) {
|
||||
if (f.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QTextStream in(&f);
|
||||
in.setCodec("UTF-8");
|
||||
while(!in.atEnd()) {
|
||||
// Name: ATBQT
|
||||
QStringList line = in.readLine().split(':');
|
||||
if (line.size() == 2) {
|
||||
if (line[0].trimmed() == "Name") {
|
||||
return line[1].trimmed();
|
||||
}
|
||||
std::ifstream f(ppid.toStdString().c_str());
|
||||
if (f.is_open()) {
|
||||
std::string next;
|
||||
while (std::getline(f, next)) {
|
||||
QString line = QString(next.c_str()).simplified();
|
||||
if (line.startsWith("Name")) {
|
||||
int const idx = line.indexOf(QChar(':'));
|
||||
if (idx != -1) {
|
||||
return line.mid(idx+1).trimmed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user