macosinstallationpkg-file

how to find out the directory of the installerplugin while installation in mac


I have created an installer plugin which would show a pane while installing the pkg file from a GUI. I need to know the location of the executable of the installerplugin run when the installation takes place, so that I could access a file relative to that path. The NSProcessInfo class is of no help as the process it refers to is the installer.app. Is there some way to find out?


Solution

  • I found out the way. We can use the NSBundle Class to locate the bundle by:

    NSBundle* iPlugin = [NSBundle bundleForClass:[MyInstallerPlugin class]];
    

    and then using

    [iPlugin bundlePath ];
    

    we can find the absolute path of the root of the bundle.