From 4c848b8f0000f67cb33a03d30c25d5c5b6d53a9b Mon Sep 17 00:00:00 2001 From: Andrey Filipenkov Date: Tue, 20 Apr 2021 00:23:44 +0300 Subject: [PATCH] fix showing icons in the launcher kambala-decapitator/vcmi#17 --- launcher/CMakeLists.txt | 13 +++++++------ launcher/mainwindow_moc.cpp | 4 ++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index 4abdb9e97..c8eab5a2e 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -130,19 +130,20 @@ target_include_directories(vcmilauncher vcmi_set_output_dir(vcmilauncher "") enable_pch(vcmilauncher) -# Copy to build directory for easier debugging -add_custom_command(TARGET vcmilauncher POST_BUILD - COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/launcher/icons - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/launcher/icons ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/launcher/icons -) - if(APPLE_IOS) + install(DIRECTORY icons DESTINATION ${DATA_DIR}) add_custom_command(TARGET vcmilauncher POST_BUILD COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --config "$" --prefix "$" COMMAND ${CMAKE_INSTALL_NAME_TOOL} -add_rpath @executable_path/Frameworks $ || true COMMAND ${CMAKE_SOURCE_DIR}/apple_codesign.sh ) else() + # Copy to build directory for easier debugging + add_custom_command(TARGET vcmilauncher POST_BUILD + COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/launcher/icons + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/launcher/icons ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/launcher/icons + ) + install(TARGETS vcmilauncher DESTINATION ${BIN_DIR}) # copy whole directory install(DIRECTORY icons DESTINATION ${DATA_DIR}/launcher) diff --git a/launcher/mainwindow_moc.cpp b/launcher/mainwindow_moc.cpp index 5da5133f2..84edd9c52 100644 --- a/launcher/mainwindow_moc.cpp +++ b/launcher/mainwindow_moc.cpp @@ -34,9 +34,13 @@ void MainWindow::load() CResourceHandler::initialize(); CResourceHandler::load("config/filesystem.json"); +#ifdef Q_OS_IOS + QDir::addSearchPath("icons", pathToQString(VCMIDirs::get().binaryPath() / "icons")); +#else for(auto & string : VCMIDirs::get().dataPaths()) QDir::addSearchPath("icons", pathToQString(string / "launcher" / "icons")); QDir::addSearchPath("icons", pathToQString(VCMIDirs::get().userDataPath() / "launcher" / "icons")); +#endif settings.init(); }