Skip to content

Commit

Permalink
fix: sed inplace portability
Browse files Browse the repository at this point in the history
  • Loading branch information
jaromil committed Nov 30, 2024
1 parent 012a881 commit 779cf37
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions build/embed-headers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,14 @@ if [ "$1" = "win" ]; then
}
fi

sed_inplace() { if [[ "$OSTYPE" == "darwin"* ]]; then sed -i'' "$*"; else sed -i "$*"; fi }
sed_inplace -e 's/unsigned char/const char/' $dst
sed_inplace -e 's/unsigned int/const unsigned int/' $dst
# sed inplace is not portable
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i'' -e 's/unsigned char/const char/' $dst
sed -i'' -e 's/unsigned int/const unsigned int/' $dst
else
sed -i -e 's/unsigned char/const char/' $dst
sed -i -e 's/unsigned int/const unsigned int/' $dst
fi

([ "$1" = "code" ] || [ "$2" = "code" ]) && {
>&2 echo "Externs to declare:"
Expand Down

0 comments on commit 779cf37

Please sign in to comment.