QString Data::getSettingsPath() const { QDir settingsPath(QDir::homePath() + "/.goya"); if (!settingsPath.exists()) { // .galerist directory doen't exists... Creating one settingsPath.mkpath(settingsPath.absolutePath()); } return QDir::toNativeSeparators(settingsPath.absolutePath()); }
bool CModManager::doEnableMod(QString mod, bool on) { QString path = mod; path = "/activeMods/" + path.replace(".", "/mods/") + "/active"; modSettings = writeValue(path, modSettings, QVariant(on)).toMap(); modList->setModSettings(modSettings["activeMods"]); modList->modChanged(mod); JsonUtils::JsonToFile(settingsPath(), modSettings); return true; }
bool CModManager::doEnableMod(QString mod, bool on) { QJsonValue value(on); QJsonObject list = modSettings["activeMods"].toObject(); list.insert(mod, value); modSettings.insert("activeMods", list); modList->setModSettings(modSettings["activeMods"].toObject()); JsonToFile(settingsPath(), modSettings); return true; }
bool CModManager::doEnableMod(QString mod, bool on) { QVariant value(on); QVariantMap list = modSettings["activeMods"].toMap(); QVariantMap modData = list[mod].toMap(); modData.insert("active", value); list.insert(mod, modData); modSettings.insert("activeMods", list); modList->setModSettings(modSettings["activeMods"]); JsonUtils::JsonToFile(settingsPath(), modSettings); return true; }
void ConsoleUpdater::onFinishStep(UpdateStep step) { switch (step) { case Init: { Logger::warning(" OK"); } break; case CleanupPreviousSession: { Logger::warning(" OK"); } break; case UpdateMirrors: { // Mirrors bool keepMirrors = _options.isSet("keep-mirrors"); Logger::warning( keepMirrors ? "\n Skipped downloading mirrors." : "\n Done downloading mirrors."); std::size_t numMirrors = _controller.GetNumMirrors(); Logger::warning( " Found %d mirror%s.", numMirrors, (numMirrors == 1 ? "" : "s") ); if( numMirrors == 0 ) { Logger::warning( " No mirror information available - cannot continue."); // Stop right here _controller.Abort(); } } break; case DownloadStableVersion: { Logger::warning( " Done downloading stable version info."); } break; case DownloadVersionInfo: { Logger::warning( " Done downloading versions."); if (!_controller.GetNewestVersion().empty()) { Logger::warning( "Newest version is " + _controller.GetNewestVersion() ); } else { Logger::warning(""); } } break; case DetermineLocalVersion: { Logger::warning( " Done comparing local files: "); if (_controller.GetLocalVersion().empty()) { Logger::warning( "no luck, zip files do not match."); } else { std::string versionFound = utils::format( 0xff, "local version is %s.", _controller.GetLocalVersion().c_str() ); Logger::warning( versionFound ); } } break; case CompareLocalFilesToNewest: { Logger::warning( " Done comparing local files to server definitions."); std::string sizeStr = Util::getHumanReadableBytes(_controller.GetTotalDownloadSize()); std::size_t numFiles = _controller.GetNumFilesToBeUpdated(); std::string totalSize = utils::format( 0xff, "%d %s to be downloaded (size: %s).", numFiles, (numFiles == 1 ? "file needs" : "files need"), sizeStr.c_str() ); vfs::Path settingsPath( "resources/settings.model" ); if( settingsPath.exist() ) { Logger::warning( "User also have own settings, remove it from downloading list" ); _controller.removeDownload( settingsPath.toString() ); } if( _options.isSet( "no-exec" ) ) { Logger::warning( "Remove executable files" ); StringArray extensions; extensions << "linux" << "macos" << "exe" << "haiku"; std::string bin="caesaria.", upd="updater."; foreach( it, extensions ) { _controller.removeDownload( bin + *it ); _controller.removeDownload( upd + *it ); } } // Print a summary if( _controller.NewUpdaterAvailable() ) { Logger::warning( " A new updater is available: " + totalSize ); } else if (_controller.LocalFilesNeedUpdate()) { Logger::warning( " Updates are available."); Logger::warning( totalSize ); } else { Logger::warning( " Your CaesarIA installation is up to date" ); } }
void CModManager::loadModSettings() { modSettings = JsonUtils::JsonFromFile(settingsPath()).toMap(); modList->setModSettings(modSettings["activeMods"]); }
QString Tano::Resources::recordings() { return settingsPath() + "recordings.xml"; }
void InitGlobals(void) { app_info ai; be_app->GetAppInfo(&ai); BPath path(&ai.ref); gAppPath = path.Path(); DPath settingsPath(B_USER_SETTINGS_DIRECTORY); settingsPath << "Paladin_settings"; gSettings.Load(settingsPath.GetFullPath()); gDontManageHeaders = gSettings.GetBool("dontmanageheaders",true); gSingleThreadedBuild = gSettings.GetBool("singlethreaded",false); gShowFolderOnOpen = gSettings.GetBool("showfolderonopen",false); gAutoSyncModules = gSettings.GetBool("autosyncmodules",true); gUseCCache = gSettings.GetBool("ccache",false); gUseFastDep = gSettings.GetBool("fastdep",false); gDefaultSCM = (scm_t)gSettings.GetInt32("defaultSCM", SCM_HG); system_info sysinfo; get_system_info(&sysinfo); gCPUCount = sysinfo.cpu_count; gPlatform = DetectPlatform(); // This will make sure that we can still build if ccache is borked and the user // wants to use it. if ((gPlatform == PLATFORM_HAIKU || gPlatform == PLATFORM_HAIKU_GCC4 || gPlatform == PLATFORM_ZETA) && system("ccache > /dev/null 2>&1") == 1) { gCCacheAvailable = true; } if (gPlatform == PLATFORM_HAIKU || gPlatform == PLATFORM_HAIKU_GCC4) { if (system("fastdep > /dev/null 2>&1") == 0) gFastDepAvailable = true; if (system("hg > /dev/null 2>&1") == 0) gHgAvailable = true; #ifndef DISABLE_GIT_SUPPORT if (system("git > /dev/null 2>&1") == 1) gGitAvailable = true; #endif gUsePipeHack = true; } if (system("svn > /dev/null 2>&1") == 1) gSvnAvailable = true; if (system("lua -v > /dev/null 2>&1") == 0) gLuaAvailable = true; gProjectPath.SetTo(gSettings.GetString("projectpath",PROJECT_PATH)); gLastProjectPath.SetTo(gSettings.GetString("lastprojectpath",PROJECT_PATH)); DPath defaultBackupPath(B_DESKTOP_DIRECTORY); gBackupPath.SetTo(gSettings.GetString("backuppath", defaultBackupPath.GetFullPath())); DPath defaultRepoPath(B_USER_DIRECTORY); defaultRepoPath << "Paladin SVN Repos"; gSVNRepoPath.SetTo(gSettings.GetString("svnrepopath", defaultRepoPath.GetFullPath())); gCodeLib.ScanFolders(); }
void CModManager::loadModSettings() { modSettings = JsonFromFile(settingsPath()); modList->setModSettings(modSettings["activeMods"].toObject()); }
void ConsoleUpdater::onFinishStep(UpdateStep step) { switch (step) { case Init: { Logger::warning(" OK"); } break; case CleanupPreviousSession: { Logger::warning(" OK"); } break; case UpdateMirrors: { // Mirrors bool keepMirrors = _d->options.isSet("keep-mirrors"); Logger::warning( keepMirrors ? "\n Skipped downloading mirrors." : "\n Done downloading mirrors."); std::size_t numMirrors = _d->controller->mirrors_n(); Logger::warning( " Found {} mirror{}.", numMirrors, (numMirrors == 1 ? "" : "s") ); if( numMirrors == 0 ) { Logger::warning( " No mirror information available - cannot continue."); // Stop right here _d->controller->abort(); } } break; case DownloadStableVersion: { Logger::warning( " Done downloading stable version info."); } break; case DownloadVersionInfo: { Logger::warning( " Done downloading versions."); if (!_d->controller->farVersion().empty()) { Logger::warning( "Newest version is " + _d->controller->farVersion() ); } else { Logger::warning(""); } } break; case DetermineLocalVersion: { Logger::warning( " Done comparing local files: "); if (_d->controller->localVersion().empty()) { Logger::warning( "no luck, zip files do not match."); } else { std::string versionFound = utils::format( 0xff, "local version is %s.", _d->controller->localVersion().c_str() ); Logger::warning( versionFound ); } } break; case CompareLocalFilesToNewest: { Logger::warning( " Done comparing local files to server definitions."); std::string sizeStr = Util::getHumanReadableBytes(_d->controller->totalDownloadSize()); std::size_t numFiles = _d->controller->flesToBeUpdated_n(); std::string totalSize = utils::format( 0xff, "%d %s to be downloaded (size: %s).", numFiles, (numFiles == 1 ? "file needs" : "files need"), sizeStr.c_str() ); vfs::Path settingsPath( "resources/settings.model" ); if( settingsPath.exist() ) { Logger::warning( "User also have own settings, remove it from downloading list" ); _d->controller->removeDownload( settingsPath.toString() ); } if( _d->options.isSet( "no-exec" ) ) { Logger::warning( "Remove executable files" ); StringArray extensions; extensions << "linux" << "macos" << "exe" << "haiku"; std::string bin="caesaria.", upd="updater."; for( auto ext : extensions ) { _d->controller->removeDownload( bin + ext ); _d->controller->removeDownload( upd + ext ); } } // Print a summary if( _d->controller->haveNewUpdater() ) { Logger::warning( " A new updater is available: " + totalSize ); } else if (_d->controller->haveNewFiles()) { Logger::warning( " Updates are available."); Logger::warning( totalSize ); } else { Logger::warning( " Your CaesarIA installation is up to date" ); } } break; case DownloadNewUpdater: { Logger::warning( " Done downloading updater - will restart the application."); } break; case DownloadDifferentialUpdate: { Logger::warning(" Done downloading the differential update."); } break; case PerformDifferentialUpdate: { Logger::warning( "Done applying the differential update." ); } break; case DownloadFullUpdate: { Logger::warning( " Done downloading updates."); std::string totalBytesStr = utils::format( 0xff, " Total bytes downloaded: %s", Util::getHumanReadableBytes(_d->controller->totalDownloadedBytes()).c_str() ); Logger::warning( totalBytesStr); if (!_d->controller->haveNewFiles()) { Logger::warning( "----------------------------------------------------------------------------"); Logger::warning( " Your CaesarIA installation is up to date."); } } break; case PostUpdateCleanup: break; case Done: _d->done = true; // break main loop break; case RestartUpdater: _d->done = true; // break main loop break; }; }