Skip to content

Commit

Permalink
Meta: Add helper for generating a C++ string from a text file
Browse files Browse the repository at this point in the history
  • Loading branch information
awesomekling committed Sep 14, 2020
1 parent ea17b0c commit 40892ac
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Meta/text-to-cpp-string.sh
Original file line number Diff line number Diff line change
@@ -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 ")\";"

0 comments on commit 40892ac

Please sign in to comment.