mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
Application info: Checking if directory exists (swift version exists) plus fixes in property functions
This commit is contained in:
@@ -13,6 +13,8 @@
|
||||
#include "blackmisc/iconlist.h"
|
||||
#include "blackmisc/comparefunctions.h"
|
||||
#include "blackconfig/buildconfig.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QStringBuilder>
|
||||
|
||||
using namespace BlackConfig;
|
||||
@@ -59,6 +61,13 @@ namespace BlackMisc
|
||||
return unknown;
|
||||
}
|
||||
|
||||
bool CApplicationInfo::isExecutablePathExisting() const
|
||||
{
|
||||
if (this->getExecutablePath().isEmpty()) { return false; }
|
||||
const QDir d(this->getExecutablePath());
|
||||
return d.exists();
|
||||
}
|
||||
|
||||
bool CApplicationInfo::isSampleOrUnitTest() const
|
||||
{
|
||||
const Application a = this->getApplication();
|
||||
@@ -112,6 +121,7 @@ namespace BlackMisc
|
||||
case IndexApplicationDataPath: return CVariant::fromValue(this->getApplicationDataDirectory());
|
||||
case IndexCompileInfo: return CVariant::fromValue(this->getCompileInfo());
|
||||
case IndexExecutablePath: return CVariant::fromValue(this->getExecutablePath());
|
||||
case IndexExecutablePathExisting: return CVariant::fromValue(this->isExecutablePathExisting());
|
||||
case IndexPlatformInfo: return CVariant::fromValue(this->getPlatform());
|
||||
case IndexProcessInfo: return m_process.propertyByIndex(index.copyFrontRemoved());
|
||||
case IndexVersionString: return CVariant::fromValue(this->getVersionString());
|
||||
@@ -132,10 +142,11 @@ namespace BlackMisc
|
||||
case IndexApplicationDataPath: this->setApplicationDataDirectory(variant.toQString()); break;
|
||||
case IndexCompileInfo: this->setCompileInfo(variant.toQString()); break;
|
||||
case IndexExecutablePath: this->setExecutablePath(variant.toQString()); break;
|
||||
case IndexExecutablePathExisting: break;
|
||||
case IndexPlatformInfo: this->setPlatformInfo(variant.toQString()); break;
|
||||
case IndexProcessInfo: m_process.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||
case IndexVersionString: this->setVersionString(variant.toQString()); break;
|
||||
case IndexWordSize: return this->setWordSize(variant.toInt()); break;
|
||||
case IndexWordSize: this->setWordSize(variant.toInt()); break;
|
||||
default: CValueObject::setPropertyByIndex(index, variant); break;
|
||||
}
|
||||
}
|
||||
@@ -146,9 +157,10 @@ namespace BlackMisc
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexApplicationDataPath: this->getApplicationDataDirectory().compare(compareValue.getApplicationDataDirectory());
|
||||
case IndexCompileInfo: this->getCompileInfo().compare(compareValue.getCompileInfo());
|
||||
case IndexExecutablePath: this->getExecutablePath().compare(compareValue.getExecutablePath());
|
||||
case IndexApplicationDataPath: return this->getApplicationDataDirectory().compare(compareValue.getApplicationDataDirectory());
|
||||
case IndexCompileInfo: return this->getCompileInfo().compare(compareValue.getCompileInfo());
|
||||
case IndexExecutablePath: return this->getExecutablePath().compare(compareValue.getExecutablePath());
|
||||
case IndexExecutablePathExisting: return Compare::compare(this->isExecutablePathExisting(), compareValue.isExecutablePathExisting());
|
||||
case IndexPlatformInfo: return this->getPlatform().compare(compareValue.getPlatform());
|
||||
case IndexProcessInfo: return this->getProcessInfo().processName().compare(compareValue.getProcessInfo().processName());
|
||||
case IndexVersionString: return this->getVersionString().compare(compareValue.getVersionString());
|
||||
|
||||
@@ -47,6 +47,7 @@ namespace BlackMisc
|
||||
IndexApplicationDataPath,
|
||||
IndexCompileInfo,
|
||||
IndexExecutablePath,
|
||||
IndexExecutablePathExisting,
|
||||
IndexPlatformInfo,
|
||||
IndexProcessInfo,
|
||||
IndexVersionString,
|
||||
@@ -74,6 +75,11 @@ namespace BlackMisc
|
||||
//! Get executable path.
|
||||
const QString &getExecutablePath() const { return m_exePath; }
|
||||
|
||||
//! Is the executable path existing?
|
||||
//! \remark this indicates if the swift version is still existing
|
||||
//! \remark file check, relatively slow
|
||||
bool isExecutablePathExisting() const;
|
||||
|
||||
//! Set application data dir
|
||||
//! \remark rootdir of settings, cache and logs
|
||||
void setApplicationDataDirectory(const QString &appDataDir) { m_applicationDataDir = appDataDir; }
|
||||
|
||||
Reference in New Issue
Block a user