Skip to content

Instantly share code, notes, and snippets.

@PierrickKoch
Created April 4, 2012 04:47
Show Gist options
  • Select an option

  • Save PierrickKoch/2297859 to your computer and use it in GitHub Desktop.

Select an option

Save PierrickKoch/2297859 to your computer and use it in GitHub Desktop.
new bge modules
#!/bin/sh
replace() {
old=$1
new=$2
files=$(grep "$old" . -lr --exclude="*.pyc" --exclude="*.blend" \
--exclude="$0" --exclude-dir="build" --exclude-dir=".git")
for f in $files; do
sed -i "s/import $old/import bge/g" $f
sed -i "s/$old/$new/g" $f
done
echo "done"
echo "files still containing $old:"
grep "$old" . -lr --exclude="*.pyc" --exclude-dir="build" \
--exclude-dir=".git"
}
replace "GameLogic" "bge.logic"
replace "VideoTexture" "bge.texture"
echo "files containing more than one import bge statement:"
grep "import bge" . -crm2 --exclude="*.pyc" --exclude-dir="build" \
--exclude-dir=".git" | grep :2
#for f in $tmp; do echo "${f%:2}"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment