Skip to content

Commit

Permalink
Improve uncrust script
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead authored and hliebscher committed Mar 31, 2021
1 parent 0a4b13d commit d1100b3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions buildroot/bin/uncrust
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
TMPDIR=`mktemp -d`

# Reformat a single file to tmp/
uncrustify -l CPP -c ./buildroot/share/extras/uncrustify.cfg -f "$1" >$TMPDIR/uncrustify.out

# Replace the original file
cp "$TMPDIR/uncrustify.out" "$1"
if uncrustify -l CPP -c ./buildroot/share/extras/uncrustify.cfg -f "$1" >$TMPDIR/uncrustify.out ; then
cp "$TMPDIR/uncrustify.out" "$1" ; # Replace the original file
else
echo "Something went wrong with uncrustify."
fi

# Clean up, deliberately
rm "$TMPDIR/uncrustify.out"
[[ -f "$TMPDIR/uncrustify.out" ]] && rm "$TMPDIR/uncrustify.out"
rmdir "$TMPDIR"

0 comments on commit d1100b3

Please sign in to comment.