How to get installer path from installer plugin

Is it possible to get the installer's path from installer plugin? For example, I have installer on ~/Documents/MyInstaller.pkg. I'd like to get the full path of the file, ie. /Users/MyName/Documents/MyInstaller.pkg (or even to /Users/MyName/Documents).

NSString *path = [[NSBundle bundleForClass:[MyPlugin class]] bundlePath];

returns the path of where the plugin is located after it was loaded, which is in a temporary folder.

NSURL 	*appBundleURL = [[NSBundle mainBundle] bundleURL];

returns /System/Library/CoreServices/Installer.app for the Installer.app's path.

I tried examining the environment variables available to the plugin using:

NSDictionary *env = [[NSProcessInfo processInfo] environment];

however there are nothing about the actual installer path.

My goal is to check if there is a certain file exists in the same folder where the installer resides, and read the information from there. The information will be used in the plugin, before installation process starts (so a preflight script would be too late in this case).

Any help would be appreciated.

How to get installer path from installer plugin
 
 
Q