From: Thiago Farina Date: Mon, 29 Nov 2010 17:09:11 GMT Subject: Re: [PATCH] Fallback on _NSGetExecutablePath to get the executable path if using argv[0] fails Message-ID: In-Reply-To: <051964C9-0507-4CCB-A111-55CA36652F00@apple.com> On Mon, Nov 29, 2010 at 2:57 PM, Jeremy Huddleston wrote: > > Signed-off-by: Jeremy Huddleston > Reviewed-by: Matt Wright > --- >  exec_cmd.c |   17 +++++++++++++++++ >  1 files changed, 17 insertions(+), 0 deletions(-) > > diff --git a/exec_cmd.c b/exec_cmd.c > index bf22570..1e24a8f 100644 > --- a/exec_cmd.c > +++ b/exec_cmd.c > @@ -3,6 +3,10 @@ >  #include "quote.h" >  #define MAX_ARGS       32 > > +#if defined(__APPLE__) && defined(RUNTIME_PREFIX) > +#include > +#endif > + >  extern char **environ; >  static const char *argv_exec_path; >  static const char *argv0_path; > @@ -53,6 +57,19 @@ const char *git_extract_argv0_path(const char *argv0) >        if (slash >= argv0) { >                argv0_path = xstrndup(argv0, slash - argv0); >                return slash + 1; > +#ifdef __APPLE__ Why not #if defined(__APPLE__), like above?