diff options
| author | crupest <crupest@outlook.com> | 2022-01-25 18:39:14 +0800 |
|---|---|---|
| committer | crupest <crupest@outlook.com> | 2022-01-25 18:39:14 +0800 |
| commit | d3aa43d9ea0dfc32935767cf60a89af2736dc339 (patch) | |
| tree | e8cf043ac6d9a2e6ce038ad6b1f57079834ef129 /src/ui | |
| parent | 71c01a175a939d1a519ab235fdfdeec1101f8b84 (diff) | |
| download | cru-d3aa43d9ea0dfc32935767cf60a89af2736dc339.tar.gz cru-d3aa43d9ea0dfc32935767cf60a89af2736dc339.tar.bz2 cru-d3aa43d9ea0dfc32935767cf60a89af2736dc339.zip | |
...
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/CMakeLists.txt | 7 | ||||
| -rw-r--r-- | src/ui/UiManager.cpp | 12 |
2 files changed, 9 insertions, 10 deletions
diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index 0c81b6c7..a86e24c0 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -59,10 +59,3 @@ add_library(cru_ui SHARED ) target_compile_definitions(cru_ui PRIVATE CRU_UI_EXPORT_API) target_link_libraries(cru_ui PUBLIC cru_platform_gui cru_xml) - -file(GLOB_RECURSE CRU_UI_RES_SOURCES "${CRU_ASSETS_DIR}/cru/ui/*") -target_sources(cru_ui PUBLIC ${CRU_UI_RES_SOURCES}) -foreach (CRU_UI_RES_FILE ${CRU_UI_RES_SOURCES}) - file(RELATIVE_PATH CRU_UI_RES_PATH ${CRU_ASSETS_DIR} ${CRU_UI_RES_FILE}) - set_property(SOURCE ${CRU_UI_RES_FILE} PROPERTY MACOSX_PACKAGE_LOCATION "Resources/${CRU_UI_RES_PATH}") -endforeach(CRU_UI_RES_FILE) diff --git a/src/ui/UiManager.cpp b/src/ui/UiManager.cpp index e374cc2e..62dce6a7 100644 --- a/src/ui/UiManager.cpp +++ b/src/ui/UiManager.cpp @@ -3,6 +3,7 @@ #include "Helper.hpp" #include "cru/common/io/FileStream.hpp" #include "cru/common/io/OpenFileFlag.hpp" +#include "cru/common/io/Resource.hpp" #include "cru/platform/graphics/Brush.hpp" #include "cru/platform/graphics/Factory.hpp" #include "cru/platform/graphics/Font.hpp" @@ -37,9 +38,14 @@ UiManager* UiManager::GetInstance() { UiManager::UiManager() { const auto factory = GetGraphicsFactory(); - // TODO: Resource file path!!! - ReadResourcesFile( - u"/Users/crupest/codes/cru/assets/cru/ui/DefaultResources.xml"); + std::filesystem::path resourses_file = + cru::io::GetResourceDir() / "cru/ui/DefaultResources.xml"; + + if (!std::filesystem::exists(resourses_file)) { + throw Exception(u"Default resources file not found."); + } + + ReadResourcesFile(String::FromStdPath(resourses_file)); theme_resource_.default_font_family = u""; |
