diff options
Diffstat (limited to 'backends/taskbar/win32/win32-taskbar.cpp')
-rw-r--r-- | backends/taskbar/win32/win32-taskbar.cpp | 35 |
1 files changed, 25 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() { |