Finding out executable location from a c program

Antti Karanta antti.karanta at napa.fi
Thu Dec 13 23:32:19 PST 2007


> -----Original Message-----
> From: Alastair Houghton [mailto:alastair at alastairs-place.net]
> 
> > Ok, I see your point - when in Rome, do as the Romans do. = )
> 
> :-)  Yeah, sort of.  

  Sorry, I was overly brief - I meant that as two separate things, i.e.
I get your point and that as I am somewhat of a stranger here (in os-x
programming, that is), I should do as the natives here do as they
probably have a good reason for doing things a certain way.


> I think my point was really that *not* trying to
> find the executable path was an easier, safer and more portable
> solution, and that there aren't really any disadvantages worth
> mentioning 

  Easier - definitely.

  Safer - ok, you've convinced me on this one. Thanks for that.

  More portable - between *nixes, yes, but in e.g. windows a hard coded
path is rare - usually the installers let you choose where you want to
install. On windows reading the location based on a registry entry might
be more "native".


  Anyway, thanks for your input. I think I'll change the source so that
according to a define given at compile time the executable will use
either a "well known location" or lookup based on the executable
location (as it's already implemented).
  But certainly you've convinced me that if (hopefully when) someone
makes a package, it will contain the version w/ hard coded path.



    -Antti-


	



More information about the MacOSX-dev mailing list