#!/bin/bash set -euo pipefail CUR_DIR="$(dirname "$0")" # Function to generate a .qrc file for a given directory and file extension generate_qrc() { local dir=$1 local qrc_file=$2 local pattern=$3 # Start the QRC file cat <"$qrc_file" EOF # Find all files with the given extension in the directory and add them to the QRC file find "$dir" -type f -name "$pattern" | while IFS= read -r file; do printf " %s\n" "$file" >>"$qrc_file" done # End the QRC file cat <>"$qrc_file" EOF # Split this to avoid vim interpreting this file as xml echo -n "" >>"$qrc_file" } pushd "$CUR_DIR" >/dev/null generate_qrc "img" "images.qrc" "*.svg" generate_qrc "qml" "qml.qrc" "*.qml" popd >/dev/null