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:
ctrlaltca 2017-07-08 11:22:29 +02:00 committed by GitHub
parent 1565309146
commit 1366e5970e
13 changed files with 217 additions and 86 deletions

View file

@ -10,12 +10,10 @@
QString SettingsCache::getDataPath()
{
return
#ifdef PORTABLE_BUILD
qApp->applicationDirPath() + "/data/";
#else
QStandardPaths::writableLocation(QStandardPaths::DataLocation);
#endif
if(isPortableBuild)
return qApp->applicationDirPath() + "/data/";
else
return QStandardPaths::writableLocation(QStandardPaths::DataLocation);
}
QString SettingsCache::getSettingsPath()
@ -25,9 +23,8 @@ QString SettingsCache::getSettingsPath()
void SettingsCache::translateLegacySettings()
{
#ifdef PORTABLE_BUILD
return;
#endif
if(isPortableBuild)
return;
//Layouts
QFile layoutFile(getSettingsPath()+"layouts/deckLayout.ini");
@ -148,6 +145,11 @@ QString SettingsCache::getSafeConfigFilePath(QString configEntry, QString defaul
}
SettingsCache::SettingsCache()
{
// first, figure out if we are running in portable mode
isPortableBuild = QFile::exists(qApp->applicationDirPath() + "/portable.dat");
if(isPortableBuild)
qDebug() << "Portable mode enabled";
// define a dummy context that will be used where needed
QString dummy = QT_TRANSLATE_NOOP("i18n", "English");