Hello, I’ve hit what I believe is an edge case bug in juce_add_bundle_resources_directory (or more likely, an issue with my usage of CMake).
Thanks to contribution of sample projects from @eyalamir, I’ve been able to create targets for a standalone audio application initially done with Projucer, the issue I’m facing is that the assets folder in that project is called “Resources”, and the CMake build ended up putting the data under “Resources/Resources”.
I’ve made a hack in the function in case folder is called “Resources” to deal with the issue but wondered if others faced this?
Here is the redefinition if it is helpful to anyone here:
# gauthier: rewrite it because bug when folder name = Resources?
function(juce_add_bundle_resources_directory target folder)
_juce_make_absolute(folder)
if(NOT EXISTS "${folder}")
message(FATAL_ERROR "Could not find resource folder ${folder}")
endif()
get_filename_component(folder_parent_path "${folder}" DIRECTORY)
file(GLOB_RECURSE resources RELATIVE "${folder_parent_path}" "${folder}/*")
# message("folder parent path: " ${folder_parent_path})
foreach(file IN LISTS resources)
# message(${file})
target_sources(${target} PRIVATE "${folder_parent_path}/${file}")
get_filename_component(resource_parent_path "${file}" DIRECTORY)
# message("resource parent path: " ${resource_parent_path} "eee")
# gauthier: edge case when file is at root of a folder and folder is named Resources.
if("Resources" STREQUAL ${resource_parent_path})
set(resource_parent_path "")
endif()
set_source_files_properties("${folder_parent_path}/${file}" PROPERTIES
HEADER_FILE_ONLY TRUE
MACOSX_PACKAGE_LOCATION "Resources/${resource_parent_path}")
endforeach()
endfunction()
Let me know if this sounds like a bug and I’ll file the issue on the github if this can be fixed upstream.
If I’m doing something wrong, is there any opensource repository which exhibits usage of resource files which happen to be placed under “Resources” folder?