Re: [PATCH] Fallback on _NSGetExecutablePath to get the executable path if using argv[0] fails
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Nov 29, 2010, 20:19 UTC
- Message-ID
- <20101129201958.GA10334@burratino>
- In-Reply-To
- <BED9E026-6804-4ABF-A26D-8F20699BAD0B@apple.com>
Jeremy Huddleston wrote:
> On Nov 29, 2010, at 13:50, Jonathan Nieder wrote: >> Jeremy Huddleston wrote: >>> On Nov 29, 2010, at 12:12, Jonathan Nieder wrote:
Show 12 quoted lines
>>>> The section "2) #ifdefs are ugly" of >>>> linux-2.6/Documentation/SubmittingPatches explains the rationale. >>> >>> I agree, but I don't really see a way around it here since this API is specific to OS X. >> >> Did you actually read that section? :) > > Yes, but I don't have the time to "do it right" right now ... I'm > contributing the patch that we are using back to the community in > the spirit of OSS development, but I don't have the time resources > currently to "do it right" at present. I'll come back to it once > time allows if nobody else picks it up.
Okay. Thanks for reporting.
My guess is that the Windows version could be simplified, too, if we introduce a function to get the path to the binary. On Linux it should use "readlink /proc/$$/exe", on Darwin the function you pointed to, on Win32 _pgmptr, as a fallback look for argv[0] in $PATH if someone on another platform is interested.
Jonathan