GHC 6.8.1 on Mac OS X 10.5 (Leopard)

Deborah Goldsmith dgoldsmith at mac.com
Mon Nov 19 12:45:16 EST 2007


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

man 3 dyld

Deborah

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 <simonmarhaskell at gmail.com>  
>> wrote:
>>> Christian Maeder wrote:
>>>> Alfonso Acosta wrote:
>>>>> On Nov 19, 2007 10:51 AM, Alfonso Acosta  
>>>>> <alfonso.acosta at gmail.com> 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 at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



More information about the Glasgow-haskell-users mailing list