On 9 Dec 2009, at 09:53, Alastair Houghton wrote:
> 
> It is possible to get the path to your executable using the dyld API, but 
> before doing such a thing you need to be very clear as to why you need it and 
> what it is that you're going to do with it.  It's very easy to end up with 
> major security holes or just plain broken behaviour.
> 
I have used the following in the past. Just curious to know what the holes and 
dodgy behaviour is likely to be.

Dl_info info;   
int errDlAddr = dladdr( (const void *)__func__, &info );
if(errDlAddr == 0) {
        return nil;
}
char *exec_path = (char *)(info.dli_fname);
        
NSString *path = [NSString stringWithCString:exec_path 
encoding:NSUTF8StringEncoding];


> Kind regards,
> 
> Alastair.
> 
> -- 
> http://alastairs-place.net
> 
> 
> 
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/jonathan%40mugginsoft.com
> 
> This email sent to jonat...@mugginsoft.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to