> OK, seems to be that way. So how do I do that from within my app? I tried
setenv("NSZombieEnabled", "YES", 1 ) but that didn't seem to work.

Proof of concept, needs to be cleaned up. Appears to work as expected,
though:

=====

uint32_t maxLen = 0x400;
char *executablePath = malloc(maxLen);
FSRef fileRef;
NSDictionary *environment = [NSDictionary dictionaryWithObject: @"YES"
forKey: @"NSZombieEnabled"];

assert(!_NSGetExecutablePath(executablePath, &maxLen));

FSPathMakeRef((UInt8 *)executablePath, &fileRef, nil);
LSApplicationParameters appParameters = {0, kLSLaunchDefaults |
kLSLaunchNewInstance, &fileRef, nil, (CFDictionaryRef)environment, nil,
nil};

LSOpenApplication(&appParameters, nil);

[NSApp terminate: nil];

=====

The LS APIs appear to prepend the current environment to whatever you
add to the environment dictionary (above), so it does not appear to be
necessary to add the current environment to that dictionary. But that
doesn't seem to be documented...
_______________________________________________

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