aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/taskbar/win32/win32-taskbar.cpp35
-rw-r--r--backends/taskbar/win32/win32-taskbar.h7
2 files changed, 32 insertions, 10 deletions
diff --git a/backends/taskbar/win32/win32-taskbar.cpp b/backends/taskbar/win32/win32-taskbar.cpp
index 3754a03c76..0cfd81e3f2 100644
--- a/backends/taskbar/win32/win32-taskbar.cpp
+++ b/backends/taskbar/win32/win32-taskbar.cpp
@@ -201,20 +201,35 @@ void Win32TaskbarManager::addRecent(const Common::String &name, const Common::St
}
Common::String Win32TaskbarManager::getIconPath(Common::String target) {
- // Get extra path
- Common::String extra = ConfMan.get("extrapath");
-
- Common::String filename = target + ".ico";
+ // We first try to look for a iconspath configuration variable then
+ // fallback to the extra path
+ //
+ // Icons can be either in a subfolder named "icons" or directly in the path
+
+ Common::String iconsPath = ConfMan.get("iconspath");
+ Common::String extraPath = ConfMan.get("extrapath");
+
+#define TRY_ICON_PATH(path) { \
+ Common::FSNode node((path)); \
+ if (node.exists()) \
+ return (path); \
+}
- if (!Common::File::exists(filename)) {
- // Try with the game id instead of the domain name
- filename = ConfMan.get("gameid") + ".ico";
+ if (!iconsPath.empty()) {
+ TRY_ICON_PATH(iconsPath + "/" + target + ".ico");
+ TRY_ICON_PATH(iconsPath + "/" + ConfMan.get("gameid") + ".ico");
+ TRY_ICON_PATH(iconsPath + "/icons/" + target + ".ico");
+ TRY_ICON_PATH(iconsPath + "/icons/" + ConfMan.get("gameid") + ".ico");
+ }
- if (!Common::File::exists(filename))
- return "";
+ if (!extraPath.empty()) {
+ TRY_ICON_PATH(extraPath + "/" + target + ".ico");
+ TRY_ICON_PATH(extraPath + "/" + ConfMan.get("gameid") + ".ico");
+ TRY_ICON_PATH(extraPath + "/icons/" + target + ".ico");
+ TRY_ICON_PATH(extraPath + "/icons/" + ConfMan.get("gameid") + ".ico");
}
- return extra + filename;
+ return "";
}
bool Win32TaskbarManager::isWin7OrLater() {
diff --git a/backends/taskbar/win32/win32-taskbar.h b/backends/taskbar/win32/win32-taskbar.h
index 0fc219e816..3415a79bd7 100644
--- a/backends/taskbar/win32/win32-taskbar.h
+++ b/backends/taskbar/win32/win32-taskbar.h
@@ -46,6 +46,13 @@ public:
private:
ITaskbarList3 *_taskbar;
+ /**
+ * Get the path to an icon for the game
+ *
+ * @param target The game target
+ *
+ * @return The icon path (or "" if no icon was found)
+ */
Common::String getIconPath(Common::String target);
// Helper functions