Copyright 2004 by M. Uli Kusterer Fri, 29 Nov -1901 11:06:32 GMT Comments on article x2005-04-18 at x2005-04-18 Comments witness_dot_of_dot_teachtext_at_gmx_dot_net (M. Uli Kusterer) witness_dot_of_dot_teachtext_at_gmx_dot_net (M. Uli Kusterer) en-us Comment 10 by michaK michaK writes:

Do you think there's any way to change the PRODUCT_NAME automatically as a PreBuild Phase ? I just want to add the svn revision to the ProductName so that each revision of the application as its own independant installation ?


Comment 9 by Uli Kusterer Uli Kusterer writes:
I remember now, why I used -exec rm -r instead of -delete: -delete silently fails when deleting a folder.
Comment 8 by Uli Kusterer Uli Kusterer writes:
Rainer, good point. I've added those, though I don't have any folders to try it on right now. Also, having a quote in one of your folder names would probably still make it choke... While shell scripts may be a lot less annoying than AppleScript, they apparently developed out of someone's very simple search-and-replace scripts, and it shows :-(

Allan, I'm pretty sure I tried -prune. Anyway, it's not that important in this case, as recent versions of Xcode all tend to get rid of excess .svn folders. So you probably won't need this script very often.
Comment 7 by Rainer Brockerhoff Rainer Brockerhoff writes:
Uli, a build script to delete .svn folders, somewhat simpler than yours, was responsible for me losing a few gigabytes of (unfortunately not backed-up) data a couple of years ago; the only time I've lost data in maybe 15 years. I had the habit of prefixing my current folder name with spaces to have it appear first in the Finder - I now use ---.

Shell scripting is not my forte, but shouldn't that be
find -d "${BUILD_DIR}/${PRODUCT_NAME}.app/Contents/Resources/" -name ".svn" -exec rm -r '{}' \; -print

Of course I'm not about to try this out on my own system ;-)
Comment 6 by Zac White Zac White writes:
Nice tips! I added the following to the help indexer stuff:

sleep 3
osascript -e 'tell app "Help Indexer" to quit'

Now it closes automatically. Handy!
Comment 5 by Allan Odgaard Allan Odgaard writes:

E.g.: find "$TARGET" -name .svn -delete -prune

Notice also I quoted the shell variable. ALWAYS quote these, otherwise, if they contain a space (or another IFS character) they will expand to multiple parameters. This is AFAIK what happened with the incident where the iTunes installer deleted peoples music library: people who had a space in their path effectively got everything deleted starting from that space (or something like that.)

Comment 4 by Uli Kusterer Uli Kusterer writes:
Only that I couldn't get the "-delete" option to work without spouting dozens of errors. I don't remember exactly what it was -- After all, this was almost a year ago.
Comment 3 by Ben Thanks, I'll try the "find" command.

Re: Delete Subversion folders

Is there any difference between "-exec rm -r '{}'" and the "-delete" option?
Comment 2 by Uli Kusterer Uli Kusterer writes:
Ben, 10.3 and earlier don't have the "-b" option in "open". So no, this won't work in Panther. This is a new option with 10.4 "Tiger". And to find other localisations, you'd probably have to use a similar approach as for the ".svn" folders: Use "find" to find all .lprojs in your app, and then base your path to be indexed on that. Or manually code a new indexing statement for each one. I don't know of a way to have Help Indexer find the different languages automatically.
Comment 1 by Ben Re: Auto-generating a Help Index

1. Assuming the bundle identifier hasn't changed, would "open -b ..." work for both Panther and Tiger?

2. If a help book has been localised, is there a way to index each localisation (other than searching for folders with the .lproj extension)?