From bfc61439fbe905db10da7eda3d4e53d01b8647cd Mon Sep 17 00:00:00 2001 From: Le Philousophe Date: Sat, 2 Sep 2023 22:46:51 +0200 Subject: [PATCH] COMMON: Make themepath a Path object --- backends/graphics/atari/atari-graphics.cpp | 2 +- backends/networking/sdl_net/handlerutils.cpp | 2 +- backends/platform/sdl/amigaos/amigaos.cpp | 4 ++-- backends/platform/sdl/kolibrios/kolibrios.cpp | 4 ++-- backends/platform/sdl/miyoo/miyoo.cpp | 4 ++-- backends/platform/sdl/opendingux/opendingux.cpp | 4 ++-- common/translation.cpp | 2 +- common/zip-set.cpp | 2 +- gui/ThemeEngine.cpp | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/backends/graphics/atari/atari-graphics.cpp b/backends/graphics/atari/atari-graphics.cpp index c77dbaabbca..4df8b3a43a8 100644 --- a/backends/graphics/atari/atari-graphics.cpp +++ b/backends/graphics/atari/atari-graphics.cpp @@ -206,7 +206,7 @@ AtariGraphicsManager::AtariGraphicsManager() { #ifndef DISABLE_FANCY_THEMES // make "themes" the default theme path if (!ConfMan.hasKey("themepath")) - ConfMan.set("themepath", "themes"); + ConfMan.setPath("themepath", "themes"); #endif ConfMan.flushToDisk(); diff --git a/backends/networking/sdl_net/handlerutils.cpp b/backends/networking/sdl_net/handlerutils.cpp index b9789547654..f32d51814ac 100644 --- a/backends/networking/sdl_net/handlerutils.cpp +++ b/backends/networking/sdl_net/handlerutils.cpp @@ -38,7 +38,7 @@ namespace Networking { Common::Archive *HandlerUtils::getZipArchive() { // first search in themepath if (ConfMan.hasKey("themepath")) { - const Common::FSNode &node = Common::FSNode(ConfMan.get("themepath")); + const Common::FSNode &node = Common::FSNode(ConfMan.getPath("themepath")); if (node.exists() && node.isReadable() && node.isDirectory()) { Common::FSNode fileNode = node.getChild(ARCHIVE_NAME); if (fileNode.exists() && fileNode.isReadable() && !fileNode.isDirectory()) { diff --git a/backends/platform/sdl/amigaos/amigaos.cpp b/backends/platform/sdl/amigaos/amigaos.cpp index ac45cce1afa..64cd279c89a 100644 --- a/backends/platform/sdl/amigaos/amigaos.cpp +++ b/backends/platform/sdl/amigaos/amigaos.cpp @@ -109,7 +109,7 @@ void OSystem_AmigaOS::initBackend() { ConfMan.registerDefault("gui_theme", "scummremastered"); ConfMan.registerDefault("gui_scale", "125"); ConfMan.registerDefault("extrapath", "extras/"); - ConfMan.registerDefault("themepath", "themes/"); + ConfMan.registerDefault("themepath", Common::Path("themes/")); // First time .ini defaults if (!ConfMan.hasKey("audio_buffer_size")) { ConfMan.set("audio_buffer_size", "2048"); @@ -139,7 +139,7 @@ void OSystem_AmigaOS::initBackend() { ConfMan.set("extrapath", "extras/"); } if (!ConfMan.hasKey("themepath")) { - ConfMan.set("themepath", "themes/"); + ConfMan.setPath("themepath", "themes/"); } OSystem_SDL::initBackend(); } diff --git a/backends/platform/sdl/kolibrios/kolibrios.cpp b/backends/platform/sdl/kolibrios/kolibrios.cpp index 904271f6f8e..6a6e1999348 100644 --- a/backends/platform/sdl/kolibrios/kolibrios.cpp +++ b/backends/platform/sdl/kolibrios/kolibrios.cpp @@ -65,13 +65,13 @@ void OSystem_KolibriOS::addSysArchivesToSearchSet(Common::SearchSet &s, int prio } void OSystem_KolibriOS::initBackend() { - Common::String defaultThemePath = _exePath.join("themes").toString(); + Common::Path defaultThemePath = _exePath.join("themes"); Common::String defaultEngineData = _exePath.join("engine-data").toString(); ConfMan.registerDefault("themepath", defaultThemePath); ConfMan.registerDefault("extrapath", defaultEngineData); if (!ConfMan.hasKey("themepath")) { - ConfMan.set("themepath", defaultThemePath); + ConfMan.setPath("themepath", defaultThemePath); } if (!ConfMan.hasKey("extrapath")) { ConfMan.set("extrapath", defaultEngineData); diff --git a/backends/platform/sdl/miyoo/miyoo.cpp b/backends/platform/sdl/miyoo/miyoo.cpp index 036041c38dc..4de97f3ffcc 100644 --- a/backends/platform/sdl/miyoo/miyoo.cpp +++ b/backends/platform/sdl/miyoo/miyoo.cpp @@ -151,7 +151,7 @@ void OSystem_SDL_Miyoo::init() { void OSystem_SDL_Miyoo::initBackend() { ConfMan.registerDefault("fullscreen", true); ConfMan.registerDefault("aspect_ratio", true); - ConfMan.registerDefault("themepath", "./themes"); + ConfMan.registerDefault("themepath", Common::Path("./themes")); ConfMan.registerDefault("extrapath", "./engine-data"); ConfMan.registerDefault("gui_theme", "builtin"); ConfMan.registerDefault("scale_factor", "1"); @@ -163,7 +163,7 @@ void OSystem_SDL_Miyoo::initBackend() { ConfMan.setBool("aspect_ratio", true); } if (!ConfMan.hasKey("themepath")) { - ConfMan.set("themepath", "./themes"); + ConfMan.setPath("themepath", "./themes"); } if (!ConfMan.hasKey("extrapath")) { ConfMan.set("extrapath", "./engine-data"); diff --git a/backends/platform/sdl/opendingux/opendingux.cpp b/backends/platform/sdl/opendingux/opendingux.cpp index 4819d542f5b..7fe4fa1a9f4 100644 --- a/backends/platform/sdl/opendingux/opendingux.cpp +++ b/backends/platform/sdl/opendingux/opendingux.cpp @@ -119,7 +119,7 @@ void OSystem_SDL_Opendingux::initBackend() { ConfMan.registerDefault("fullscreen", true); #endif ConfMan.registerDefault("aspect_ratio", true); - ConfMan.registerDefault("themepath", "./themes"); + ConfMan.registerDefault("themepath", Common::Path("./themes")); ConfMan.registerDefault("extrapath", "./engine-data"); ConfMan.registerDefault("gui_theme", "builtin"); ConfMan.registerDefault("scale_factor", "1"); @@ -131,7 +131,7 @@ void OSystem_SDL_Opendingux::initBackend() { ConfMan.setBool("aspect_ratio", true); } if (!ConfMan.hasKey("themepath")) { - ConfMan.set("themepath", "./themes"); + ConfMan.setPath("themepath", "./themes"); } if (!ConfMan.hasKey("extrapath")) { ConfMan.set("extrapath", "./engine-data"); diff --git a/common/translation.cpp b/common/translation.cpp index 74993fc1ac2..a1ea14f8b6e 100644 --- a/common/translation.cpp +++ b/common/translation.cpp @@ -222,7 +222,7 @@ String TranslationManager::getLangById(int id) const { bool TranslationManager::openTranslationsFile(File &inFile) { // First look in the Themepath if we can find the file. - if (ConfMan.hasKey("themepath") && openTranslationsFile(FSNode(ConfMan.get("themepath")), inFile)) + if (ConfMan.hasKey("themepath") && openTranslationsFile(FSNode(ConfMan.getPath("themepath")), inFile)) return true; // Then try to open it using the SearchMan. diff --git a/common/zip-set.cpp b/common/zip-set.cpp index 0391aed0c55..3cf1d2e811e 100644 --- a/common/zip-set.cpp +++ b/common/zip-set.cpp @@ -60,7 +60,7 @@ bool generateZipSet(SearchSet &searchSet, const char *defaultFile, const char *p dat = nullptr; if (ConfMan.hasKey("themepath")) { - FSNode *fs = new FSNode(normalizePath(ConfMan.get("themepath") + "/" + defaultFile, '/')); + FSNode *fs = new FSNode(ConfMan.getPath("themepath").join(defaultFile).normalize()); if (fs->exists()) { dat = makeZipArchive(*fs); } diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index bffdcbd9de0..7e982ff4fed 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -1941,7 +1941,7 @@ void ThemeEngine::listUsableThemes(Common::List &list) { #endif if (ConfMan.hasKey("themepath")) - listUsableThemes(Common::FSNode(ConfMan.get("themepath")), list); + listUsableThemes(Common::FSNode(ConfMan.getPath("themepath")), list); listUsableThemes(SearchMan, list);