[nautilus/uncrustify-tweaks: 3/4] run-uncrustify.sh: detect if uncrustify is not installed



commit c64756756910789c8cf4f0523a2fe45e0ac79682
Author: Ernestas Kulik <ernestask gnome org>
Date:   Wed Feb 14 11:13:04 2018 +0200

    run-uncrustify.sh: detect if uncrustify is not installed
    
    Otherwise it will keep spamming stderr about the command not being
    found.

 data/run-uncrustify.sh | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/data/run-uncrustify.sh b/data/run-uncrustify.sh
index c7f1a836b..68caae130 100755
--- a/data/run-uncrustify.sh
+++ b/data/run-uncrustify.sh
@@ -1,5 +1,13 @@
 #!/bin/bash
 DATA=$(dirname "$BASH_SOURCE")
+UNCRUSTIFY=$(command -v uncrustify)
+
+if [ -z "$UNCRUSTIFY" ];
+then
+    echo "Uncrustify is not installed on your system."
+    exit 1
+fi
+
 if [ -x "$DATA/lineup-parameters" ];
 then
     for DIR in "$DATA/../"{src,test,libnautilus-extension,eel,extensions}
@@ -7,7 +15,7 @@ then
         for FILE in $(find "$DIR" -name "*.c")
         do
             # Aligning prototypes is not working yet, so avoid headers
-            uncrustify -c "$DATA/uncrustify.cfg" --no-backup "$FILE"
+            "$UNCRUSTIFY" -c "$DATA/uncrustify.cfg" --no-backup "$FILE"
             "$DATA/lineup-parameters" "$FILE" > "$FILE.temp" && mv "$FILE.temp" "$FILE"
        done
     done


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]