File: generateDirtyFiles

package info (click to toggle)
rawtherapee 5.12-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 124,328 kB
  • sloc: cpp: 271,715; ansic: 27,904; sh: 1,109; python: 521; cs: 155; xml: 57; makefile: 15
file content (26 lines) | stat: -rwxr-xr-x 1,099 bytes parent folder | download | duplicates (5)
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
26
#!/usr/bin/env bash
# Search files for keywords, then do something to the files which don't match

# Path to the RawTherapee repository
pushd $HOME/programs/code-rawtherapee >/dev/null
unset uses match m u
# Key to search for, e.g. an include
IFS="
" read -a match <<< $(grep -rni iomanip rt* | cut -d ":" -f1 | sort -uV)
# Keys to search for which should be used by the one above, e.g. the functions given by the include
IFS="
" read -a uses <<< $(egrep -si "setiosflags|resetiosflags|setbase|setfill|setprecision|setw|get_money|put_money|get_time|put_time" rtgui/* rtengine/* rtexif/* | sed 's/	/ /g' | cut -d ":" -f 1 | sort -Vu)
for m in ${match[@]}; do
    for u in ${uses[@]}; do
        if [[ $m == $u ]]; then
            godmode=true;
        fi
    done
    if [[ $godmode != true ]]; then
# Do something to the files which match the first key but not the second bunch of keys, e.g. remove the include from the files which don't use any of the functions it provides.
        echo "$m to be cleaned"
        sed -i '/#include <iomanip>/d' "$m"
    fi
    unset godmode
done
popd >/dev/null