Selaa lähdekoodia

Improve uncrust script

Scott Lahteine 3 vuotta sitten
vanhempi
commit
f587a4e3f3
1 muutettua tiedostoa jossa 6 lisäystä ja 5 poistoa
  1. 6
    5
      buildroot/bin/uncrust

+ 6
- 5
buildroot/bin/uncrust Näytä tiedosto

@@ -6,11 +6,12 @@
6 6
 TMPDIR=`mktemp -d`
7 7
 
8 8
 # Reformat a single file to tmp/
9
-uncrustify -l CPP -c ./buildroot/share/extras/uncrustify.cfg -f "$1" >$TMPDIR/uncrustify.out
10
-
11
-# Replace the original file
12
-cp "$TMPDIR/uncrustify.out" "$1"
9
+if uncrustify -l CPP -c ./buildroot/share/extras/uncrustify.cfg -f "$1" >$TMPDIR/uncrustify.out ; then
10
+  cp "$TMPDIR/uncrustify.out" "$1"  ; # Replace the original file
11
+else
12
+  echo "Something went wrong with uncrustify."
13
+fi
13 14
 
14 15
 # Clean up, deliberately
15
-rm "$TMPDIR/uncrustify.out"
16
+[[ -f "$TMPDIR/uncrustify.out" ]] && rm "$TMPDIR/uncrustify.out"
16 17
 rmdir "$TMPDIR"

Loading…
Peruuta
Tallenna