summaryrefslogtreecommitdiff
path: root/Meta/text-to-cpp-string.sh
blob: a988da6799469131f2533c26d98ad54a9d7d94ed (plain)
1
2
3
4
5
6
7
8
9
10
#!/usr/bin/env bash
# $1 name of the variable
# $2 input path

echo "extern const char $1[];"
printf "const char %s[] = R\"~~~(" "$1"
grep -v '^ *#' < "$2" | while IFS= read -r line; do
  echo "$line"
done
echo ")~~~\";"