aboutsummaryrefslogtreecommitdiff
path: root/backends/taskbar/win32
diff options
context:
space:
mode:
authorJulien2011-06-16 16:09:20 -0400
committerJulien2011-06-16 16:09:20 -0400
commit154c584d44d689f0a7b521b49c5ce245a52fb992 (patch)
tree25b41bdee4d126dcea01ddbf31cf777cde5bcae9 /backends/taskbar/win32
parent96c1e97459dbcd5422dbdf42df9c370c086d6a22 (diff)
downloadscummvm-rg350-154c584d44d689f0a7b521b49c5ce245a52fb992.tar.gz
scummvm-rg350-154c584d44d689f0a7b521b49c5ce245a52fb992.tar.bz2
scummvm-rg350-154c584d44d689f0a7b521b49c5ce245a52fb992.zip
BACKENDS: Enhance Win32TaskbarManager::getIconPath()
We now look for an iconsPath configuration variable with the path to the icons folder. In addition, we look if there is an "icons" subfolder (useful when using extrapath to store icons)
Diffstat (limited to 'backends/taskbar/win32')
-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