COMMON: Make extrapath a Path object

This commit is contained in:
Le Philousophe 2023-09-02 22:46:51 +02:00 committed by Eugene Sandulenko
parent bfc61439fb
commit 802c91554f
12 changed files with 32 additions and 32 deletions

View file

@ -58,13 +58,13 @@ void SdlEventSource::loadGameControllerMappingFile() {
warning("Game controller DB file not found: %s", file.getPath().c_str());
}
if (!loaded && ConfMan.hasKey("extrapath")) {
Common::FSNode dir = Common::FSNode(ConfMan.get("extrapath"));
Common::FSNode dir = Common::FSNode(ConfMan.getPath("extrapath"));
Common::FSNode file = dir.getChild(GAMECONTROLLERDB_FILE);
if (file.exists()) {
if (SDL_GameControllerAddMappingsFromFile(file.getPath().c_str()) < 0)
error("File %s not valid: %s", file.getPath().c_str(), SDL_GetError());
if (SDL_GameControllerAddMappingsFromFile(file.getPath().toString(Common::Path::kNativeSeparator).c_str()) < 0)
error("File %s not valid: %s", file.getPath().toString(Common::Path::kNativeSeparator).c_str(), SDL_GetError());
else
debug("Game controller DB file loaded: %s", file.getPath().c_str());
debug("Game controller DB file loaded: %s", file.getPath().toString(Common::Path::kNativeSeparator).c_str());
}
}
}

View file

@ -108,7 +108,7 @@ void OSystem_AmigaOS::initBackend() {
ConfMan.registerDefault("gui_mode", "antialias");
ConfMan.registerDefault("gui_theme", "scummremastered");
ConfMan.registerDefault("gui_scale", "125");
ConfMan.registerDefault("extrapath", "extras/");
ConfMan.registerDefault("extrapath", Common::Path("extras/"));
ConfMan.registerDefault("themepath", Common::Path("themes/"));
// First time .ini defaults
if (!ConfMan.hasKey("audio_buffer_size")) {
@ -136,7 +136,7 @@ void OSystem_AmigaOS::initBackend() {
ConfMan.set("gui_scale", "125");
}
if (!ConfMan.hasKey("extrapath")) {
ConfMan.set("extrapath", "extras/");
ConfMan.setPath("extrapath", "extras/");
}
if (!ConfMan.hasKey("themepath")) {
ConfMan.setPath("themepath", "themes/");

View file

@ -66,7 +66,7 @@ void OSystem_KolibriOS::addSysArchivesToSearchSet(Common::SearchSet &s, int prio
void OSystem_KolibriOS::initBackend() {
Common::Path defaultThemePath = _exePath.join("themes");
Common::String defaultEngineData = _exePath.join("engine-data").toString();
Common::Path defaultEngineData = _exePath.join("engine-data");
ConfMan.registerDefault("themepath", defaultThemePath);
ConfMan.registerDefault("extrapath", defaultEngineData);
@ -74,7 +74,7 @@ void OSystem_KolibriOS::initBackend() {
ConfMan.setPath("themepath", defaultThemePath);
}
if (!ConfMan.hasKey("extrapath")) {
ConfMan.set("extrapath", defaultEngineData);
ConfMan.setPath("extrapath", defaultEngineData);
}
// Create the savefile manager

View file

@ -152,7 +152,7 @@ void OSystem_SDL_Miyoo::initBackend() {
ConfMan.registerDefault("fullscreen", true);
ConfMan.registerDefault("aspect_ratio", true);
ConfMan.registerDefault("themepath", Common::Path("./themes"));
ConfMan.registerDefault("extrapath", "./engine-data");
ConfMan.registerDefault("extrapath", Common::Path("./engine-data"));
ConfMan.registerDefault("gui_theme", "builtin");
ConfMan.registerDefault("scale_factor", "1");
@ -166,7 +166,7 @@ void OSystem_SDL_Miyoo::initBackend() {
ConfMan.setPath("themepath", "./themes");
}
if (!ConfMan.hasKey("extrapath")) {
ConfMan.set("extrapath", "./engine-data");
ConfMan.setPath("extrapath", "./engine-data");
}
if (!ConfMan.hasKey("savepath")) {
ConfMan.set("savepath", SAVE_PATH);

View file

@ -120,7 +120,7 @@ void OSystem_SDL_Opendingux::initBackend() {
#endif
ConfMan.registerDefault("aspect_ratio", true);
ConfMan.registerDefault("themepath", Common::Path("./themes"));
ConfMan.registerDefault("extrapath", "./engine-data");
ConfMan.registerDefault("extrapath", Common::Path("./engine-data"));
ConfMan.registerDefault("gui_theme", "builtin");
ConfMan.registerDefault("scale_factor", "1");
@ -134,7 +134,7 @@ void OSystem_SDL_Opendingux::initBackend() {
ConfMan.setPath("themepath", "./themes");
}
if (!ConfMan.hasKey("extrapath")) {
ConfMan.set("extrapath", "./engine-data");
ConfMan.setPath("extrapath", "./engine-data");
}
if (!ConfMan.hasKey("savepath")) {
ConfMan.set("savepath", SAVE_PATH);

View file

@ -120,7 +120,7 @@ bool VirtualKeyboard::loadKeyboardPack(const String &packName) {
if (ConfMan.hasKey("vkeybdpath"))
opened = openPack(packName, new FSDirectory(ConfMan.get("vkeybdpath")), DisposeAfterUse::YES);
else if (ConfMan.hasKey("extrapath"))
opened = openPack(packName, new FSDirectory(ConfMan.get("extrapath")), DisposeAfterUse::YES);
opened = openPack(packName, new FSDirectory(ConfMan.getPath("extrapath")), DisposeAfterUse::YES);
// fallback to SearchMan
if (!opened)

View file

@ -277,7 +277,7 @@ static Common::Error runGame(const Plugin *plugin, const Plugin *enginePlugin, O
// Add extrapath (if any) to the directory search list
if (ConfMan.hasKey("extrapath")) {
dir = Common::FSNode(ConfMan.get("extrapath"));
dir = Common::FSNode(ConfMan.getPath("extrapath"));
SearchMan.addDirectory(dir);
}
@ -286,9 +286,9 @@ static Common::Error runGame(const Plugin *plugin, const Plugin *enginePlugin, O
// verify that it's not already there before adding it. The search manager will
// check for that too, so this check is mostly to avoid a warning message.
if (ConfMan.hasKey("extrapath", Common::ConfigManager::kApplicationDomain)) {
Common::String extraPath = ConfMan.get("extrapath", Common::ConfigManager::kApplicationDomain);
if (!SearchMan.hasArchive(extraPath)) {
dir = Common::FSNode(extraPath);
Common::Path extraPath = ConfMan.getPath("extrapath", Common::ConfigManager::kApplicationDomain);
dir = Common::FSNode(extraPath);
if (!SearchMan.hasArchive(dir.getPath().toString())) {
SearchMan.addDirectory(dir);
}
}

View file

@ -161,7 +161,7 @@ protected:
// Icons can be either in a subfolder named "icons" or directly in the path
Common::Path iconsPath = ConfMan.getPath("iconspath");
Common::String extraPath = ConfMan.get("extrapath");
Common::Path extraPath = ConfMan.getPath("extrapath");
Common::String targetIcon = target + extension;
Common::String qualifiedIcon = ConfMan.get("engineid") + "-" + ConfMan.get("gameid") + extension;
@ -185,14 +185,14 @@ return (path); \
}
if (!extraPath.empty()) {
TRY_ICON_PATH(extraPath + "/" + targetIcon);
TRY_ICON_PATH(extraPath + "/" + qualifiedIcon);
TRY_ICON_PATH(extraPath + "/" + gameIcon);
TRY_ICON_PATH(extraPath + "/" + engineIcon);
TRY_ICON_PATH(extraPath + "/icons/" + targetIcon);
TRY_ICON_PATH(extraPath + "/icons/" + qualifiedIcon);
TRY_ICON_PATH(extraPath + "/icons/" + gameIcon);
TRY_ICON_PATH(extraPath + "/icons/" + engineIcon);
TRY_ICON_PATH(extraPath.join(targetIcon));
TRY_ICON_PATH(extraPath.join(qualifiedIcon));
TRY_ICON_PATH(extraPath.join(gameIcon));
TRY_ICON_PATH(extraPath.join(engineIcon));
TRY_ICON_PATH(extraPath.join("icons/" + targetIcon));
TRY_ICON_PATH(extraPath.join("icons/" + qualifiedIcon));
TRY_ICON_PATH(extraPath.join("icons/" + gameIcon));
TRY_ICON_PATH(extraPath.join("icons/" + engineIcon));
}
#undef TRY_ICON_PATH

View file

@ -101,7 +101,7 @@ bool AchievementsManager::loadAchievementsData(const char *platform, const char
Archive *cfgZip = nullptr;
if (!cfgZip && ConfMan.hasKey("extrapath")) {
Common::FSDirectory extrapath(ConfMan.get("extrapath"));
Common::FSDirectory extrapath(ConfMan.getPath("extrapath"));
cfgZip = Common::makeZipArchive(extrapath.createReadStreamForMember("achievements.dat"));
}

View file

@ -893,7 +893,7 @@ Font *loadTTFFont(Common::SeekableReadStream &stream, int size, TTFSizeMode size
Font *loadTTFFontFromArchive(const Common::String &filename, int size, TTFSizeMode sizeMode, uint dpi, TTFRenderMode renderMode, const uint32 *mapping) {
Common::SeekableReadStream *archiveStream = nullptr;
if (ConfMan.hasKey("extrapath")) {
Common::FSDirectory extrapath(ConfMan.get("extrapath"));
Common::FSDirectory extrapath(ConfMan.getPath("extrapath"));
archiveStream = extrapath.createReadStreamForMember("fonts.dat");
}
@ -914,7 +914,7 @@ Font *loadTTFFontFromArchive(const Common::String &filename, int size, TTFSizeMo
// Trying fonts-cjk.dat
if (ConfMan.hasKey("extrapath")) {
Common::FSDirectory extrapath(ConfMan.get("extrapath"));
Common::FSDirectory extrapath(ConfMan.getPath("extrapath"));
archiveStream = extrapath.createReadStreamForMember("fonts-cjk.dat");
}

View file

@ -97,7 +97,7 @@ static const GLchar *readFile(const Common::String &filename) {
#endif
if (ConfMan.hasKey("extrapath")) {
SearchMan.addDirectory("EXTRA_PATH", Common::FSNode(ConfMan.get("extrapath")), 0, 2);
SearchMan.addDirectory("EXTRA_PATH", Common::FSNode(ConfMan.getPath("extrapath")), 0, 2);
}
#if !defined(IPHONE)
shaderDir = "shaders/";

View file

@ -975,8 +975,8 @@ Graphics::MacWindowManager *GuiManager::getWM() {
return _wm;
if (ConfMan.hasKey("extrapath")) {
Common::FSNode dir(ConfMan.get("extrapath"));
SearchMan.addDirectory(dir.getPath(), dir);
Common::FSNode dir(ConfMan.getPath("extrapath"));
SearchMan.addDirectory(dir);
}
uint32 wmMode = Graphics::kWMModeNoDesktop | Graphics::kWMMode32bpp | Graphics::kWMModeNoCursorOverride;