Created
October 16, 2011 07:03
-
-
Save carlosmcevilly/1290596 to your computer and use it in GitHub Desktop.
project rename helper for Xcode 3.x projects.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# project rename helper for Xcode 3.x projects. Not yet updated for Xcode 4.x (in particular, workspaces) | |
# makes some assumptions about file locations which may differ from your project layout. | |
# important: also assumes it's OK to rename *every* instance of <oldname> to <newname> in | |
# your project, even in places where they might not be acting as names. | |
echo "this is outdated, so this is provided for reference only. use at your own risk" | |
exit # refuse to run. anyone who runs this should read and understand the whole thing before removing this line. | |
export old=$1 | |
export new=$2 | |
if [ "$new" == '' ]; then | |
echo usage: $0 original-name new-name | |
exit -1 | |
fi | |
temp_dir=`pwd` | |
export proj_dir=`basename $temp_dir` | |
perl -pi -e '$new=$ENV{"new"};$old=$ENV{"old"}; s/\b$old\b/$new/g;' *.{h,m,xib,pbxproj,pbxuser,mode1v3,plist} | |
cd Classes | |
perl -pi -e '$new=$ENV{"new"};$old=$ENV{"old"}; s/\b$old\b/$new/g;' *.{h,m,xib,pbxproj,pbxuser,mode1v3,plist} | |
cd .. | |
cd $proj_dir.xcodeproj | |
perl -pi -e '$new=$ENV{"new"};$old=$ENV{"old"}; s/\b$old\b/$new/g;' *.{pbxproj,pbxuser,mode1v3,plist} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment