2024-12-05 00:28:46 +00:00
|
|
|
#!/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 <<EOF >"$qrc_file"
|
|
|
|
<!DOCTYPE RCC>
|
|
|
|
<RCC version="1.0">
|
|
|
|
<qresource>
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# Find all files with the given extension in the directory and add them to the QRC file
|
2024-12-07 22:11:19 +00:00
|
|
|
find "$dir" -type f -name "$pattern" | sort | while IFS= read -r file; do
|
2024-12-05 00:28:46 +00:00
|
|
|
printf " <file>%s</file>\n" "$file" >>"$qrc_file"
|
|
|
|
done
|
|
|
|
|
|
|
|
# End the QRC file
|
|
|
|
cat <<EOF >>"$qrc_file"
|
|
|
|
</qresource>
|
|
|
|
</RCC>
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# Split this to avoid vim interpreting this file as xml
|
|
|
|
echo -n "<!-- vi" >>"$qrc_file"
|
|
|
|
echo ": ft=xml" >>"$qrc_file"
|
|
|
|
echo "-->" >>"$qrc_file"
|
|
|
|
}
|
|
|
|
|
2024-12-05 01:41:24 +00:00
|
|
|
pushd "$CUR_DIR/qml" >/dev/null
|
|
|
|
generate_qrc "../img" "images.qrc" "*.svg"
|
|
|
|
generate_qrc "../qml" "qml.qrc" "*.qml"
|
2024-12-05 00:28:46 +00:00
|
|
|
popd >/dev/null
|