#!/bin/sh

# We try to get the path of all running application processes
# There is no API to do that correctly, and doing it from ObjC means doing unix or mach specific calls.

# First we make a ps, remove the start of the PS and everything after the first space (nobody put spaces in directory names... :) )
/bin/ps x | sed -e 's/^....................//g' | /usr/bin/sed -e 's/ .*//g' > /tmp/$$.tmp

# We just have to keep the '.app' and the '.debug' from this list

/usr/bin/grep '\.app/[^/]*$' /tmp/$$.tmp | /usr/bin/sed -e 's/\/[^\/]*$//g'
/usr/bin/grep '\.debug/[^/]*$' /tmp/$$.tmp | /usr/bin/sed -e 's/\/[^\/]*$//g'

/bin/rm /tmp/$$.tmp
