diff options
| author | LostDragonist <lost.dragonist@gmail.com> | 2019-09-16 16:32:37 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-09-16 16:32:37 -0500 |
| commit | 0d6eb8bd4ce37ebf9efb1436d401efbcc9ffa440 (patch) | |
| tree | 06ed754185e3b1dbbfe09563ca4a0499cc5aace7 /src/instancemanager.cpp | |
| parent | 99fdbb2539227cec4fab534efc7420cfc5ca1a92 (diff) | |
| parent | 4d9c1db885bd3ab230440b25e70dcd8049cf4650 (diff) | |
Merge pull request #831 from LostDragonist/portable_lock
Add portable lock feature
Diffstat (limited to 'src/instancemanager.cpp')
| -rw-r--r-- | src/instancemanager.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/instancemanager.cpp b/src/instancemanager.cpp index fdc30e22..c0d343de 100644 --- a/src/instancemanager.cpp +++ b/src/instancemanager.cpp @@ -186,6 +186,10 @@ QString InstanceManager::queryInstanceName(const QStringList &instanceList) cons QString InstanceManager::chooseInstance(const QStringList &instanceList) const { + if (portableInstallIsLocked()) { + return QString(); + } + enum class Special : uint8_t { NewInstance, Portable, @@ -266,6 +270,19 @@ bool InstanceManager::portableInstall() const } +bool InstanceManager::portableInstallIsLocked() const +{ + return QFile::exists(qApp->applicationDirPath() + "/" + + QString::fromStdWString(AppConfig::portableLockFileName())); +} + + +bool InstanceManager::allowedToChangeInstance() const +{ + return !portableInstallIsLocked(); +} + + void InstanceManager::createDataPath(const QString &dataPath) const { if (!QDir(dataPath).exists()) { @@ -286,6 +303,10 @@ void InstanceManager::createDataPath(const QString &dataPath) const QString InstanceManager::determineDataPath() { QString instanceId = currentInstance(); + if (portableInstallIsLocked()) + { + instanceId.clear(); + } if (instanceId.isEmpty() && !m_Reset && (m_overrideInstance || portableInstall())) { // startup, apparently using portable mode before |
