From 061bbfeca04856238669b06dbfde9cbdb0da53b3 Mon Sep 17 00:00:00 2001 From: Nomango Date: Mon, 22 Jun 2020 21:34:27 +0800 Subject: [PATCH] get icon path from FileSystem --- src/kiwano/platform/win32/WindowImpl.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/kiwano/platform/win32/WindowImpl.cpp b/src/kiwano/platform/win32/WindowImpl.cpp index ced5351e..3246ce21 100644 --- a/src/kiwano/platform/win32/WindowImpl.cpp +++ b/src/kiwano/platform/win32/WindowImpl.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include // GET_X_LPARAM, GET_Y_LPARAM #include // ImmAssociateContext @@ -227,10 +228,14 @@ void WindowWin32Impl::Init(const String& title, uint32_t width, uint32_t height, wcex.hIcon = (HICON)::LoadImage(hinst, MAKEINTRESOURCE(icon.resource_id), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR | LR_CREATEDIBSECTION | LR_DEFAULTSIZE); } - else if (!icon.file_path.empty()) + else { - wcex.hIcon = (HICON)::LoadImageA(NULL, icon.file_path.c_str(), IMAGE_ICON, 0, 0, - LR_DEFAULTCOLOR | LR_CREATEDIBSECTION | LR_DEFAULTSIZE | LR_LOADFROMFILE); + String full_path = FileSystem::GetInstance().GetFullPathForFile(icon.file_path); + if (!full_path.empty()) + { + wcex.hIcon = (HICON)::LoadImageA(NULL, full_path.c_str(), IMAGE_ICON, 0, 0, + LR_DEFAULTCOLOR | LR_CREATEDIBSECTION | LR_DEFAULTSIZE | LR_LOADFROMFILE); + } } ::RegisterClassExA(&wcex);