Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
How to get installer path from plugin
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to get installer path from plugin



Hi,

I'm trying to get the .pkg installer's path from Installer Plugin. Let's say my plugin is called Register.bundle and it is kept within MyInstaller.pkg/Contents/Plugins/.  I also have a file that I need access to from the plugin and postinstal. The file is stored in MyInstaller.pkg/Contents/Resources/MyFile

From my installer plugin code, I can do

- (void)willEnterPane:(InstallerSectionDirection)dir
{
:
:
NSBundle * registerPaneBundle = [[self section] bundle];

NSString * registerBundlePath = [registerPaneBundle bundlePath];

NSRange range = [bundlePath rangeOfString:@"Plugins/Registration.bundle"];
if (range.location != NSNotFound)
{
NSString * myfilePath = [NSString stringWithFormat:@"%@Resources/MyFile",
[registerBundlePath substringWithRange:NSMakeRange(0, range.location)]];
:
:
}

    registerBundlePath should be set to /Users/wwibowo/MyInstaller.pkg/Contents/Plugins/Register.bundle, and
    myFilePath should be set to /Users/wwibowo/MyInstaller.pkg/Contents/Resources/MyFile

This is all good if the installer is located on local drive (boot volume or partition). However if I have the installer on a mounted disk image or on USB key, the installer bundle seems to be moved out of the .pkg file. What I am getting instead is

    registerBundlePath = /tmp/com.apple.installerulrZkLhr/Register.bundle
    range = {NSNotFound, 0}

I know PACKAGE_PATH holds the path to the package, unfortunately it is only available in postinstall. Is there another environment variable, or a way to get the package's path from plugin and postinstall? I wonder if installing from network drive or read-only media (CD, DVD) produce different behavior with regards to the plugin being detached from the installer, and if so, how would I know the installer's path.

Thanks,
Wrekso

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Installer-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.