[Scummvm-git-logs] scummvm master -> a5844fd8daa66830eb3ccb227d1c994549f44ec4

sev- sev at scummvm.org
Fri Nov 12 14:47:48 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
a5844fd8da GUI: Added possibility to keep gui-icons.dat in iconspath


Commit: a5844fd8daa66830eb3ccb227d1c994549f44ec4
    https://github.com/scummvm/scummvm/commit/a5844fd8daa66830eb3ccb227d1c994549f44ec4
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-11-12T15:47:22+01:00

Commit Message:
GUI: Added possibility to keep gui-icons.dat in iconspath

Changed paths:
    gui/gui-manager.cpp


diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp
index acaf6ec4ac..affa379f72 100644
--- a/gui/gui-manager.cpp
+++ b/gui/gui-manager.cpp
@@ -111,14 +111,34 @@ GuiManager::~GuiManager() {
 void GuiManager::initIconsSet() {
 	Common::Archive *dat;
 
-	// ConfMan.get("iconspath")
+	const char fname[] = "gui-icons.dat";
+	Common::String path;
+	Common::FSNode *fs = nullptr;
 
-	Common::String path = "gui-icons.dat";
+	if (ConfMan.hasKey("themepath")) {
+		path = normalizePath(ConfMan.get("themepath") + "/" + fname, '/');
 
-	if (ConfMan.hasKey("themepath"))
-		path = normalizePath(ConfMan.get("themepath") + "/" + path, '/');
+		fs = new Common::FSNode(path);
+		if (!fs->exists()) {
+			delete fs;
+			fs = nullptr;
+		}
+	}
+
+	if (!fs && ConfMan.hasKey("iconspath")) {
+		path = normalizePath(ConfMan.get("iconspath") + "/" + fname, '/');
+
+		fs = new Common::FSNode(path);
+		if (!fs->exists()) {
+			delete fs;
+			fs = nullptr;
+		}
+	}
 
-	dat = Common::makeZipArchive(Common::FSNode(path));
+	if (!fs)
+		fs = new Common::FSNode(fname);
+
+	dat = Common::makeZipArchive(*fs);
 
 	if (!dat) {
 		warning("GUI: Could not find '%s'", path.c_str());
@@ -126,6 +146,8 @@ void GuiManager::initIconsSet() {
 	}
 
 	_iconsSet.add(path, dat);
+
+	delete fs;
 }
 
 void GuiManager::computeScaleFactor() {




More information about the Scummvm-git-logs mailing list