@@ -12,9 +12,28 @@ set(_project_dir "${PROJECT_SOURCE_DIR}/Minecraft.Client")
1212function (copy_tree_if_exists src_rel dst_rel)
1313 set (_src "${_project_dir} /${src_rel} " )
1414 set (_dst "${OUTPUT_DIR} /${dst_rel} " )
15+
1516 if (EXISTS "${_src} " )
1617 file (MAKE_DIRECTORY "${_dst} " )
17- execute_process (COMMAND "${CMAKE_COMMAND} " -E copy_directory "${_src} " "${_dst} " )
18+ file (GLOB_RECURSE _files RELATIVE "${_src} " "${_src} /*" )
19+
20+ foreach (_file IN LISTS _files) # if not a source file
21+ if (NOT _file MATCHES "\\ .(cpp|c|h|hpp|xml|lang)$" )
22+ set (_full_src "${_src} /${_file} " )
23+ set (_full_dst "${_dst} /${_file} " )
24+
25+ if (IS_DIRECTORY "${_full_src} " )
26+ file (MAKE_DIRECTORY "${_full_dst} " )
27+ else ()
28+ get_filename_component (_dst_dir "${_full_dst} " DIRECTORY )
29+ file (MAKE_DIRECTORY "${_dst_dir} " )
30+ execute_process (
31+ COMMAND "${CMAKE_COMMAND} " -E copy_if_different
32+ "${_full_src} " "${_full_dst} "
33+ )
34+ endif ()
35+ endif ()
36+ endforeach ()
1837 endif ()
1938endfunction ()
2039
@@ -25,10 +44,15 @@ endfunction()
2544function (copy_file_if_exists src_rel dst_rel)
2645 set (_src "${PROJECT_SOURCE_DIR} /${src_rel} " )
2746 set (_dst "${OUTPUT_DIR} /${dst_rel} " )
47+
48+ get_filename_component (_dst_dir "${_dst} " DIRECTORY )
49+ file (MAKE_DIRECTORY "${_dst_dir} " )
50+
2851 if (EXISTS "${_src} " )
29- get_filename_component (_dst_dir "${_dst} " DIRECTORY )
30- file (MAKE_DIRECTORY "${_dst_dir} " )
31- execute_process (COMMAND "${CMAKE_COMMAND} " -E copy_if_different "${_src} " "${_dst} " )
52+ execute_process (
53+ COMMAND "${CMAKE_COMMAND} " -E copy_if_different
54+ "${_src} " "${_dst} "
55+ )
3256 endif ()
3357endfunction ()
3458
@@ -46,24 +70,24 @@ function(copy_first_existing dst_rel)
4670 endif ()
4771endfunction ()
4872
49- if ( CONFIGURATION STREQUAL "Debug" )
50- copy_tree_if_exists( "Durango/Sound" "Durango/Sound " )
51- copy_tree_if_exists( "music" "music " )
52- copy_tree_if_exists( "Windows64/GameHDD" "Windows64/GameHDD " )
53- copy_tree_if_exists( "Common/Media" "Common/Media" )
54- copy_tree_if_exists( "Common/res" "Common/res" )
55- copy_tree_if_exists( "Common/Trial" "Common/Trial" )
56- copy_tree_if_exists("Common/Tutorial " "Common/Tutorial " )
57- else ( )
58- copy_tree_if_exists("music " "music " )
59- copy_tree_if_exists( "Windows64/GameHDD " "Windows64/GameHDD " )
60- copy_tree_if_exists("Common/Media " "Common/Media " )
61- copy_tree_if_exists("Common/res " "Common/res " )
62- copy_tree_if_exists("Common/Trial " "Common/Trial " )
63- copy_tree_if_exists("Common/Tutorial " "Common/Tutorial " )
64- copy_tree_if_exists("DurangoMedia " "Windows64Media" )
65- copy_tree_if_exists( "Windows64Media" "Windows64Media" )
66- endif ( )
73+ function (remove_directory_if_exists rel_path )
74+ set (_dir " ${OUTPUT_DIR} / ${rel_path} " )
75+ if ( EXISTS " ${_dir} " )
76+ file (REMOVE_RECURSE " ${_dir} " )
77+ endif ( )
78+ endfunction ( )
79+
80+ copy_tree_if_exists("Durango/Sound " "Windows64/Sound " )
81+ copy_tree_if_exists( "music" "music" )
82+ copy_tree_if_exists("Windows64/GameHDD " "Windows64/GameHDD " )
83+ copy_file_if_exists( "Minecraft.Client/Common/Media/MediaWindows64.arc " "Common/Media/MediaWindows64.arc " )
84+ copy_tree_if_exists("Common/res " "Common/res " )
85+ copy_tree_if_exists("Common/Trial " "Common/Trial " )
86+ copy_tree_if_exists("Common/Tutorial " "Common/Tutorial " )
87+ copy_tree_if_exists("DurangoMedia " "Windows64Media " )
88+ copy_tree_if_exists("Windows64Media " "Windows64Media" )
89+
90+ remove_directory_if_exists( "Windows64Media/Layout" )
6791
6892# Some runtime code asserts if this directory tree is missing.
6993ensure_dir("Windows64/GameHDD" )
0 commit comments