A handy zsh function (for OS X)

A co-worker of mine was having problems remembering where the makefile puts the binary for Thunderbird when you build it yourself. Now, I type in the path far too often, so I know where it is (on my computer, anyways), but since I type it in far too often, I grabbed someone's zsh function that launched Firefox, and modified it to launch Thunderbird from either the build directory or the source directory, but only on Mac OS X.

Anyways, here it is, I hope some of you find it useful.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
thunderbird() {
  local -a currdir;
  currdir=$PWD:t;
  for nm in LanikaiDebug ShredderDebug Lanikai Shredder; do
    if [ -d "./mozilla/dist/$nm.app" ]; then
      ./mozilla/dist/$nm.app/Contents/MacOS/thunderbird-bin $*
      break;
    elif [ -d "../objdir-$currdir/mozilla/dist/$nm.app" ]; then
      ../objdir-$currdir/mozilla/dist/$nm.app/Contents/MacOS/thunderbird-bin $*
      break;
    fi
  done
}