Deborah Goldsmith wrote,
If you want to get the path to the main executable on Mac OS X, use _NSGetExecutablePath. See:

man 3 dyld

That's exactly what we need. The man page is on the web for those without a mac:

  
http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/dyld.3.html

Thanks Deborah!

Manuel

On Nov 19, 2007, at 4:07 AM, Christian Maeder wrote:

An additional sanity check of "topdir" makes sense then.

Christian

Alfonso Acosta wrote:
Simon, as usual, is right. It's been quite a while since I last
seriously coded in C. From the exec* man page:

"The first argument, *by convention*, should point to the file name
associated with the file being executed."

However, if nothing better is found I guess it's better to rely on an
extended convention rather than hardcoding paths.

On Nov 19, 2007 11:40 AM, Simon Marlow <[EMAIL PROTECTED]> wrote:
Christian Maeder wrote:
Alfonso Acosta wrote:
On Nov 19, 2007 10:51 AM, Alfonso Acosta <[EMAIL PROTECTED] > wrote:
Well, you can always combine the first argument of the script ($0) for
absolute paths and combine it with with pwd for relative ones.
I meant _use_ the first argument of the script ($0) for absolute paths
and combine it with pwd for relative ones.
#!/bin/sh
reldir=`dirname $0`
topdir=`(cd $reldir; pwd)`
There's no guarantee that $0 holds anything reasonable: you can set $0 to
whatever you like when calling exec*().

Cheers,
      Simon

_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to