Meta: Add helper for generating a C++ string from a text file

This commit is contained in:
Andreas Kling 2020-09-14 12:50:38 +02:00
parent ea17b0cbb6
commit 40892ac72e
Notes: sideshowbarker 2024-07-19 02:25:43 +09:00

11
Meta/text-to-cpp-string.sh Executable file
View file

@ -0,0 +1,11 @@
#!/bin/sh
# $1 name of the variable
# $2 input path
echo "extern const char $1[];"
echo -n "const char $1[] = R\"("
grep -v '^ *#' < "$2" | while IFS= read -r line; do
echo "$line"
done
echo ")\";"