瀏覽代碼

fix showing icons in the launcher

kambala-decapitator/vcmi#17
Andrey Filipenkov 4 年之前
父節點
當前提交
4c848b8f00
共有 2 個文件被更改,包括 11 次插入6 次删除
  1. 7 6
      launcher/CMakeLists.txt
  2. 4 0
      launcher/mainwindow_moc.cpp

+ 7 - 6
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 "$<CONFIG>" --prefix "$<TARGET_BUNDLE_CONTENT_DIR:vcmilauncher>"
 		COMMAND ${CMAKE_INSTALL_NAME_TOOL} -add_rpath @executable_path/Frameworks $<TARGET_FILE:vcmilauncher> || 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)

+ 4 - 0
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();
 }