[nautilus] general: Allow running uncrustify from elsewhere



commit a67d17b142ce8f4830d10f4623a8ebda1c0809ed
Author: Jan Tojnar <jtojnar gmail com>
Date:   Tue Feb 28 18:00:42 2017 +0100

    general: Allow running uncrustify from elsewhere
    
    run-uncrustify.sh script uses cwd relative file names, which fails
    if it is ran from the repository root or other directory.
    
    This commit fixes the paths relative to the script.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=779408

 data/run-uncrustify.sh |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/data/run-uncrustify.sh b/data/run-uncrustify.sh
index 3114f55..39bb290 100755
--- a/data/run-uncrustify.sh
+++ b/data/run-uncrustify.sh
@@ -1,13 +1,14 @@
 #!/bin/bash
-if [ -x "lineup-parameters" ];
+DATA=$(dirname "$BASH_SOURCE")
+if [ -x "$DATA/lineup-parameters" ];
 then
-    for DIR in ../src ../nautilus-desktop ../test ../libnautilus-extension ../eel 
../nautilus-sendto-extension
+    for DIR in "$DATA/../"{src,nautilus-desktop,test,libnautilus-extension,eel,nautilus-sendto-extension}
     do
-        for FILE in $(find $DIR -name "*.c")
+        for FILE in $(find "$DIR" -name "*.c")
         do
             # Aligning prototypes is not working yet, so avoid headers
-            uncrustify -c uncrustify.cfg --no-backup $FILE
-            ./lineup-parameters $FILE > $FILE.temp && mv $FILE.temp $FILE
+            uncrustify -c "$DATA/uncrustify.cfg" --no-backup "$FILE"
+            "$DATA/lineup-parameters" "$FILE" > "$FILE.temp" && mv "$FILE.temp" "$FILE"
        done
     done
 else


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