Quellcode durchsuchen

Improve uncrust script

Scott Lahteine vor 3 Jahren
Ursprung
Commit
f587a4e3f3
1 geänderte Dateien mit 6 neuen und 5 gelöschten Zeilen
  1. 6
    5
      buildroot/bin/uncrust

+ 6
- 5
buildroot/bin/uncrust Datei anzeigen

@@ -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"

Laden…
Abbrechen
Speichern