"Benjamin Smedberg" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Tom Lee wrote:
> > successfully removed my component from Netscape but all that is left is
> > deleting the files within the tree. I have a 6 files in the components
> > directory and 1 file within the chrome directory. Is there an easy way
to
>
> You can get the directory locations from the nsIDirectoryService
> interface... see
> http://lxr.mozilla.org/seamonkey/source/xpcom/io/nsIDirectoryService.idl
> for the interface. You can obtain the interface thus:
>
> var dirService =
>
Components.classes["@mozilla.org/file/directory_service;1"].getService(Compo
nents.interfaces.nsIDirectoryService);
>
> See
> http://lxr.mozilla.org/seamonkey/source/xpcom/io/nsDirectoryServiceDefs.h
> for the appropriate strings... you probably want
> NS_XPCOM_COMPONENT_DIR     "ComsD"
> and
> NS_OS_CURRENT_PROCESS_DIR  "CurProcD"\
>
> Once you have obtained an nsIFile, you can .Append your filenames to it
> and use the .Remove() method. see
> http://lxr.mozilla.org/seamonkey/source/xpcom/io/nsIFile.idl
>
> CAUTION:
> you probably cannot remove your components while netscape is running.
> You might be able to tell XPCOM to unload a specific component so that
> you can delete it, but I don't know how.
>
> You should also note that you really ought to update the
> installed-chrome.txt file to remove your chrome references and
> re-register chrome. Unfortunately, this is currently impossible (or
> almost-impossible, requiring large hackery). I'm working on a better way
> to install and uninstall extensions, but it's going to take a while to
> get all the pieces working properly.
>
> --BDS
>

Thank you for your reply. I never new that those defines existed within the
tree.

You were correct. I thought if I had removed the toolbar from Netscape that
my XPCOM components and type libraries would be unloaded. Wrong assumption!
I get an error if I try to delete the files.

The only way I found to remove the components is to check for the existance
of them on a re-install, and if they exist - remove them. That worked fine
on the XPCOM components and type libraries, but not on the JAR (contains XUL
and JS stuff) within the chrome folder. I have to re-install the software
twice before my toolbar appears in Netscape. I believe the first time the
jar is deleted and the next time the jar is installed. The uninstall on both
attempts displays a successful result.This was not the behavior I was hoping
for - but id does get the job done in a round about fashion. This is a
little snippet of what I tried to do.


fChrome = getFolder("Chrome");

var delJarFile = getFolder(fChrome, myJarFileName);
if(File.exists(delJarFile))            // If exists from previous
installation - delete it.
{
 File.remove(delJarFile);
 logComment("Removing: " + delJarFile);
}


setPackageFolder(fChrome);


err = addFile(myJarFileName)

logComment("addFile() returned: " + err);

err = registerChrome(PACKAGE | DELAYED_CHROME,
getFolder(fChrome,myJarFileName), "content/");

logComment("regChrome returned: " + err);



if(err == ACCESS_DENIED)
{
 alert("Unable to write to Chrome directory "+fChrome+".\n You will need to
restart the browser with administrator/root privileges to install this
software. After installing as root (or administrator), you will need to
restart the browser one more time to register the installed software.\n
After the second restart, you can go back to running the browser without
privileges!");
 cancelInstall(ACCESS_DENIED);
}
else if (err != SUCCESS)
{
    cancelInstall(err);
}
else
{
    performInstall();
}



Reply via email to