Launching app dirs from the shell

An easy way to launch App Dirs from your shell without patching the shell.

This only works with httpzsh
Add to your /.zshrc:

  alias rehash="rehash; . ~/bin/load-appdir-cache.sh"
  [ "$DISPLAY" ] && . ~/bin/load-appdir-cache.sh

Create this /bin/load-appdir-cache.sh:

  APPDIR_CACHE=${HOME}/.appdir_cache
  if [ -f $APPDIR_CACHE ]; then
    cat $APPDIR_CACHE | while read item; do hash $item; done
  fi

And this /bin/update-appdir-cache:

  #!/bin/sh
  APPDIR_CACHE=${HOME}/.appdir_cache
  echo Updating AppDir cache... >/dev/stderr
  echo -n > $APPDIR_CACHE
  find /ROX-Apps ~/Apps -name AppRun | while read app; do
    echo "$(basename $(dirname $app))=$app" >> $APPDIR_CACHE
  done

Make sure to change /ROX-Apps to where your appdirs live, like /usr/local/apps
Then make this script executable:

  chmod +x ~/bin/update-appdir-cache

And put it in your Auto Start folder:

ln -sf ~/bin/update-appdir-cache ~/Choices/ROX-Session/AutoStart/

Can shells such as bash be made application directory aware?

You can use httpthis patch to add support to bash.