From 40892ac72e5f03af4dba15b2bf22b095f00250c2 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 14 Sep 2020 12:50:38 +0200 Subject: [PATCH] Meta: Add helper for generating a C++ string from a text file --- Meta/text-to-cpp-string.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 Meta/text-to-cpp-string.sh diff --git a/Meta/text-to-cpp-string.sh b/Meta/text-to-cpp-string.sh new file mode 100755 index 00000000000..4330b0dba79 --- /dev/null +++ b/Meta/text-to-cpp-string.sh @@ -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 ")\";" +