Skip to content

Commit a6eb0f5

Browse files
committedJun 10, 2015
fix directories in sort script (followup 684b2bd)
1 parent 684b2bd commit a6eb0f5

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed
 

‎scripts/sort_include.sh

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,25 @@
2222
# can exlcude directories (hard-copies of external libraries)
2323

2424
SORTING=false
25-
FILE1=.sort_include_1.tmp
26-
FILE2=.sort_include_2.tmp
27-
FILE3=.sort_include_3.tmp
25+
FILE1="sort_include_1.tmp"
26+
FILE2="sort_include_2.tmp"
27+
FILE3="sort_include_3.tmp"
2828

2929
# files not to be sorted (leads to compile errors otherwise)
3030
DoNotSort="(sqlite3.h)|(spatialite.h)"
3131

3232
for file in $(find . \
33-
! -path "src/app/gps/qwtpolar-*" \
34-
! -path "src/core/gps/qextserialport/*" \
35-
! -path "src/plugins/grass/qtermwidget/*" \
36-
! -path "src/astyle/*" \
37-
! -path "python/ext-libs/*" \
38-
! -path "src/providers/spatialite/qspatialite/*" \
39-
! -path "src/plugins/dxf2shp_converter/dxflib/src/*" \
40-
! -path "src/plugins/globe/osgEarthQt/*" \
41-
! -path "src/plugins/globe/osgEarthUtil/*" \
42-
-type f -regex "(src)|(tests)/(.+/)*.*\.\(h\|cpp\)")
33+
! -path "./src/app/gps/qwtpolar-*" \
34+
! -path "./src/core/gps/qextserialport/*" \
35+
! -path "./src/plugins/grass/qtermwidget/*" \
36+
! -path "./src/astyle/*" \
37+
! -path "./python/ext-libs/*" \
38+
! -path "./src/providers/spatialite/qspatialite/*" \
39+
! -path "./src/plugins/dxf2shp_converter/dxflib/src/*" \
40+
! -path "./src/plugins/globe/osgEarthQt/*" \
41+
! -path "./src/plugins/globe/osgEarthUtil/*" \
42+
-regex "./src/\(.+/\)*.*\.\(h\|cpp\)" -type f \
43+
-or -regex "./tests/\(.+/\)*.*\.\(h\|cpp\)" -type f )
4344
do
4445
echo "$file"
4546
touch $FILE1
@@ -54,9 +55,9 @@ do
5455
if [[ "$line" =~ ^"#"include[[:space:]]*\"ui_ ]]; then
5556
echo "$line" >> $FILE1 # keep ui_ on top of list
5657
elif [[ "$line" =~ ^"#"include[[:space:]]*\<[^[:space:]]+\> ]]; then
57-
echo "$line" >> $FILE2
58+
echo "$line" >> $FILE2 # include <...>
5859
else
59-
echo "$line" >> $FILE3
60+
echo "$line" >> $FILE3 # include "..."
6061
fi
6162
else
6263
if $SORTING; then
@@ -68,8 +69,12 @@ do
6869
echo "$line" >> $FILE1
6970
fi
7071
done < "$file"
71-
rm -f $FILE2 $FILE3
72+
if $SORTING; then
73+
sort -u $FILE2 >> $FILE1
74+
sort -u $FILE3 >> $FILE1
75+
SORTING=false
76+
fi
7277
mv $FILE1 $file
73-
rm -f $FILE1
78+
rm -f $FILE1 $FILE2 $FILE3
7479
done
7580

0 commit comments

Comments
 (0)
Please sign in to comment.