mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
Bash helper script to find wrongly-cased file names in DEFs and
maybe replace them with the proper names. Usage: checkdefs.sh <some.def> [[<some_dir>] -patch] <some_dir> is taken to be the base directory of the search path. -patch uses 'sed -i' to replace the offending findings git-svn-id: https://svn.eduke32.com/eduke32@2081 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
9018359a9e
commit
f938e0bc11
1 changed files with 47 additions and 0 deletions
47
polymer/eduke32/build/src/util/checkdefs.sh
Executable file
47
polymer/eduke32/build/src/util/checkdefs.sh
Executable file
|
@ -0,0 +1,47 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo 'Usage: checkdefs.sh <some.def> [[<some_dir>] -patch]'
|
||||
fi
|
||||
deffn="$1"
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
thedir=.
|
||||
else
|
||||
thedir="$2"
|
||||
fi
|
||||
|
||||
if [ -n "$3" ]; then
|
||||
if [ "$3" != "-patch" ]; then
|
||||
echo 'Usage: checkdefs.sh <some.def> [[<some_dir>] -patch]'
|
||||
fi
|
||||
fi
|
||||
|
||||
files=$(grep -E "\".*\..*\"" "$deffn" | sed 's/.*"\(.*\..*\)".*/\1/g')
|
||||
|
||||
exfiles=$(find "$thedir" -type f)
|
||||
|
||||
sedcmd=""
|
||||
|
||||
for i in $files; do
|
||||
fn="$thedir/$i"
|
||||
if [ ! -f "$fn" ]; then
|
||||
# try finding a matching file
|
||||
match=$(echo "$exfiles" | grep -i "^$fn$")
|
||||
|
||||
if [ -z "$match" ]; then
|
||||
echo "$fn"
|
||||
else
|
||||
echo "$fn --> $match"
|
||||
sedcmd="$sedcmd;s|\"$i\"|\"${match#$thedir/}\"|g"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$3" ]; then
|
||||
if [ -n "$sedcmd" ]; then
|
||||
echo "Patching $deffn"
|
||||
# echo "$sedcmd"
|
||||
sed -i "$sedcmd" "$deffn"
|
||||
fi
|
||||
fi
|
Loading…
Reference in a new issue