mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Portable mode for windows (#2794)
* Portable mode for windows * fix start menu in portable mode * Make gcc an happy puppy * Clean old installation if we are installing over an old portable mode installation * Default to Desktop\CockatricePortable * Settings dialog fixes * wording
This commit is contained in:
parent
1565309146
commit
1366e5970e
13 changed files with 217 additions and 86 deletions
|
|
@ -2,10 +2,14 @@
|
|||
#include <QCoreApplication>
|
||||
#include <QFile>
|
||||
#include <QStandardPaths>
|
||||
#include <QDebug>
|
||||
|
||||
SettingsCache::SettingsCache(const QString & fileName, QSettings::Format format, QObject * parent)
|
||||
:QSettings(fileName, format, parent)
|
||||
{
|
||||
// first, figure out if we are running in portable mode
|
||||
isPortableBuild = QFile::exists(qApp->applicationDirPath() + "/portable.dat");
|
||||
|
||||
QStringList disallowedRegExpStr = value("users/disallowedregexp", "").toString().split(",", QString::SkipEmptyParts);
|
||||
disallowedRegExpStr.removeDuplicates();
|
||||
for (const QString ®ExpStr : disallowedRegExpStr) {
|
||||
|
|
@ -16,9 +20,12 @@ SettingsCache::SettingsCache(const QString & fileName, QSettings::Format format,
|
|||
QString SettingsCache::guessConfigurationPath(QString & specificPath)
|
||||
{
|
||||
const QString fileName="servatrice.ini";
|
||||
#ifdef PORTABLE_BUILD
|
||||
return fileName;
|
||||
#endif
|
||||
if(QFile::exists(qApp->applicationDirPath() + "/portable.dat"))
|
||||
{
|
||||
qDebug() << "Portable mode enabled";
|
||||
return fileName;
|
||||
}
|
||||
|
||||
QString guessFileName;
|
||||
// specific path
|
||||
if(!specificPath.isEmpty() && QFile::exists(specificPath))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue