nsIExtensionManager::GetInstallLocation returnung NULL on Mac OS X - Mozilla

This is a discussion on nsIExtensionManager::GetInstallLocation returnung NULL on Mac OS X - Mozilla ; Hi group, I have the following C++ code in my extension: nsresult rv; nsCOMPtr file; nsCOMPtr installLocation; nsCOMPtr em(do_GetService("@mozilla.org/extensions/manager;1")); if(em) { rv = em->GetInstallLocation(NS_LITERAL_STRING("myextension@myname.com"), getter_AddRefs(installLocation)); NS_ENSURE_SUCCESS(rv, ""); if(installLocation) { rv = installLocation->GetLocation(getter_AddRefs(file)); } } .... This works perfectly on all ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: nsIExtensionManager::GetInstallLocation returnung NULL on Mac OS X

  1. nsIExtensionManager::GetInstallLocation returnung NULL on Mac OS X

    Hi group,

    I have the following C++ code in my extension:

    nsresult rv;

    nsCOMPtr file;
    nsCOMPtr installLocation;
    nsCOMPtr
    em(do_GetService("@mozilla.org/extensions/manager;1"));

    if(em)
    {
    rv =
    em->GetInstallLocation(NS_LITERAL_STRING("myextension@myname.com"),
    getter_AddRefs(installLocation));
    NS_ENSURE_SUCCESS(rv, "");

    if(installLocation)
    {
    rv = installLocation->GetLocation(getter_AddRefs(file));
    }
    }
    ....

    This works perfectly on all my windows boxes. On Mac OS X,
    em->GetInstallLocation always returns NULL for installLocation. What am I
    doing wrong?

    Thanks


  2. Re: nsIExtensionManager::GetInstallLocation returnung NULL on MacOS X

    Georg Kalus wrote:
    > Hi group,
    >
    > I have the following C++ code in my extension:
    >
    > nsresult rv;
    >
    > nsCOMPtr file;
    > nsCOMPtr installLocation;
    > nsCOMPtr
    > em(do_GetService("@mozilla.org/extensions/manager;1"));
    >
    > if(em)
    > {
    > rv =
    > em->GetInstallLocation(NS_LITERAL_STRING("myextension@myname.com"),
    > getter_AddRefs(installLocation));
    > NS_ENSURE_SUCCESS(rv, "");
    >
    > if(installLocation)
    > {
    > rv = installLocation->GetLocation(getter_AddRefs(file));
    > }
    > }
    > ...
    >
    > This works perfectly on all my windows boxes. On Mac OS X,
    > em->GetInstallLocation always returns NULL for installLocation. What am
    > I doing wrong?
    >
    > Thanks


    Quite a bit of code in the EM relies on getInstallLocation so I'd be
    surprised to find it failing. It should return null if the extension
    isn't installed, perhaps the ID is not quite right (check case
    sensitivity). Are you getting a failure code back?

    Dave

  3. Re: nsIExtensionManager::GetInstallLocation returnung NULL on Mac OS X

    Dave, thank you very much for your reply.

    I doubt that this is because of a wrong or misspelled ID. The same code does
    work under windows.

    I am not so sure about whether the extension is installed correctly under
    Mac OS X. When can I consider the extension to be installed correctly? If
    installed means that it appears in the Extras | Add-ons dialog, then yes, it
    definetly is installed.

    Also, all the XUL/javascript of the extension does appear and work
    correctly. And finally, the C++ XPCOM component is registered and working,
    too, otherwise I wouldn't get to the problematic snippet below.

    About a failure code: I do get past the
    NS_ENSURE_SUCCESS(rv, "");
    line, so I would say no. Or are you talking about some other failure code?

    On a sidenote: I did notice that extensions.ini contains what appears to be
    gibberish on Mac OS X wheras on windows it contains the paths to the
    installed extensions... but then, other extensions *do* work under Mac OS X.

    Thanks,
    Georg

    "Dave Townsend" schrieb im Newsbeitrag
    news:y5adnQITgslAAXLbnZ2dnUVZ_gmdnZ2d@mozilla.org. ..
    > Georg Kalus wrote:
    >> Hi group,
    >>
    >> I have the following C++ code in my extension:
    >>
    >> nsresult rv;
    >>
    >> nsCOMPtr file;
    >> nsCOMPtr installLocation;
    >> nsCOMPtr
    >> em(do_GetService("@mozilla.org/extensions/manager;1"));
    >>
    >> if(em)
    >> {
    >> rv =
    >> em->GetInstallLocation(NS_LITERAL_STRING("myextension@myname.com"),
    >> getter_AddRefs(installLocation));
    >> NS_ENSURE_SUCCESS(rv, "");
    >>
    >> if(installLocation)
    >> {
    >> rv = installLocation->GetLocation(getter_AddRefs(file));
    >> }
    >> }
    >> ...
    >>
    >> This works perfectly on all my windows boxes. On Mac OS X,
    >> em->GetInstallLocation always returns NULL for installLocation. What am I
    >> doing wrong?
    >>
    >> Thanks

    >
    > Quite a bit of code in the EM relies on getInstallLocation so I'd be
    > surprised to find it failing. It should return null if the extension isn't
    > installed, perhaps the ID is not quite right (check case sensitivity). Are
    > you getting a failure code back?
    >
    > Dave



  4. Re: nsIExtensionManager::GetInstallLocation returnung NULL on Mac OS X

    I've now tried the following piece in the javascript part of the extension:

    em =
    Components.classes["@mozilla.org/extensions/manager;1"].getService.Components.interfaces.nsIExtensionMana ger);
    var nsfile = em.getInstallLocation("myextension@myname.com").location;

    This works and I get back the path I wanted. I still don't understand what's
    wrong with the C++ below.

    Thanks,
    Georg

    "Georg Kalus" schrieb im Newsbeitrag
    news:T56dncmvwaoDb3LbnZ2dnUVZ_rCtnZ2d@mozilla.org. ..
    > Dave, thank you very much for your reply.
    >
    > I doubt that this is because of a wrong or misspelled ID. The same code
    > does work under windows.
    >
    > I am not so sure about whether the extension is installed correctly under
    > Mac OS X. When can I consider the extension to be installed correctly? If
    > installed means that it appears in the Extras | Add-ons dialog, then yes,
    > it definetly is installed.
    >
    > Also, all the XUL/javascript of the extension does appear and work
    > correctly. And finally, the C++ XPCOM component is registered and working,
    > too, otherwise I wouldn't get to the problematic snippet below.
    >
    > About a failure code: I do get past the
    > NS_ENSURE_SUCCESS(rv, "");
    > line, so I would say no. Or are you talking about some other failure code?
    >
    > On a sidenote: I did notice that extensions.ini contains what appears to
    > be gibberish on Mac OS X wheras on windows it contains the paths to the
    > installed extensions... but then, other extensions *do* work under Mac OS
    > X.
    >
    > Thanks,
    > Georg
    >
    > "Dave Townsend" schrieb im Newsbeitrag
    > news:y5adnQITgslAAXLbnZ2dnUVZ_gmdnZ2d@mozilla.org. ..
    >> Georg Kalus wrote:
    >>> Hi group,
    >>>
    >>> I have the following C++ code in my extension:
    >>>
    >>> nsresult rv;
    >>>
    >>> nsCOMPtr file;
    >>> nsCOMPtr installLocation;
    >>> nsCOMPtr
    >>> em(do_GetService("@mozilla.org/extensions/manager;1"));
    >>>
    >>> if(em)
    >>> {
    >>> rv =
    >>> em->GetInstallLocation(NS_LITERAL_STRING("myextension@myname.com"),
    >>> getter_AddRefs(installLocation));
    >>> NS_ENSURE_SUCCESS(rv, "");
    >>>
    >>> if(installLocation)
    >>> {
    >>> rv = installLocation->GetLocation(getter_AddRefs(file));
    >>> }
    >>> }
    >>> ...
    >>>
    >>> This works perfectly on all my windows boxes. On Mac OS X,
    >>> em->GetInstallLocation always returns NULL for installLocation. What am
    >>> I doing wrong?
    >>>
    >>> Thanks

    >>
    >> Quite a bit of code in the EM relies on getInstallLocation so I'd be
    >> surprised to find it failing. It should return null if the extension
    >> isn't installed, perhaps the ID is not quite right (check case
    >> sensitivity). Are you getting a failure code back?
    >>
    >> Dave

    >



+ Reply to Thread