ladybird/Meta/text-to-cpp-string.sh
Linus Groh 7ad31651bd Meta: Use a bash shebang for text-to-cpp-string.sh
Previously we had /bin/sh, which might be bash but is run in POSIX mode
on some systems, causing read -r to not work correctly and inserting
newlines when encountering literal "\n" in the source.

Fixes #5040.
2021-01-22 18:41:08 +01:00

11 lines
221 B
Bash
Executable File

#!/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 ")~~~\";"