summaryrefslogtreecommitdiff
path: root/data/run-uncrustify.sh
blob: 68caae1308bb4b195593ae65cb5c142675d2384c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/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}
    do
        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"
            "$DATA/lineup-parameters" "$FILE" > "$FILE.temp" && mv "$FILE.temp" "$FILE"
       done
    done
else
    echo "Script lineup-parameters does not exists here in (source directory)/data, probably because Nautilus was built in a different directory than the source directory.
Copy the program in the (build directory)/data/lineup-parameters here in (source directory)/data and run again run-uncrustify.sh."
fi