From 71273f9021dd786877b9470220a1dc05e05bdec2 Mon Sep 17 00:00:00 2001 From: Alexander Shaduri Date: Wed, 1 Dec 2021 14:51:59 +0400 Subject: [PATCH] Support macos stat command in file2csource.sh. --- file2csource.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/file2csource.sh b/file2csource.sh index 5aa73a9..c434cf8 100755 --- a/file2csource.sh +++ b/file2csource.sh @@ -24,7 +24,12 @@ fi in_file="$1"; out_file="$2"; sym_name="$3"; -size=`stat -c "%s" "$in_file"` +size=""; +if [[ $OSTYPE == 'darwin'* ]]; then + size=`stat "-f%z" "$in_file"` +else + size=`stat -c "%s" "$in_file"` +fi # header. extern means "global" in this context (needed because const