Skip to content

@mx4492 /removeXcodeTemplateFluff.sh
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Remove the comments automatically added by Xcode 4.4 to newly created files
#!/bin/bash
# WARNING: USE AT YOUR OWN RISK
# requires SUDO
# Ideally, the Templates in the user's home directory should override the
# defaults, but I can't get this to work for Xcode 4.4, hence the following
# !! WORKAROUND !! hacky solution to edit them in place
#
# And this does not work completely, the files added when the default project
# is created seem to be unaffected, only subsequently added files are.
set -e
# http://www.bobmccune.com/2012/03/04/creating-custom-xcode-4-file-templates/
export X1="/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates"
export X2="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates"
# For Debugging
set -x && set -v && set -o verbose
function replaceTemplate() { \
cp -r "$1" "$1.bak"
find -E "$1" -type f -regex '.*\.(c|h|m)' -exec sed -i '' '1,/^$/d' '{}' ';'
}
replaceTemplate $X1
replaceTemplate $X2
@mx4492
Owner

This is a bit dangerous. The first time around you might want to manually browse to the correct folders and run the following

find -E . -type f -regex '.*\.(c|h|m)' -exec sed -i '' '1,/^$/d' '{}' ';'
@mx4492
Owner

Forgot I'd posted this. Here is the newer incarnation (which is the same):
https://gist.github.com/mx4492/81da9f3c363bc1c44f4e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.