Fixing tree blocker. nsInstallFolder did not return an error code when

it could not initialize itself.  This caused crashes and return values which
were not correct.  I also fixed a huge about of memory leaks for allocation
of strings that were never freed.  r=dveditz, a=leaf.


git-svn-id: svn://10.0.0.236/trunk@67001 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dougt%netscape.com
2000-04-24 22:23:44 +00:00
parent 8237a54fdd
commit ff1dd2ab65
10 changed files with 244 additions and 179 deletions

View File

@@ -36,7 +36,7 @@
#include "prlock.h"
#include "NSReg.h"
#include "VerReg.h"
#include "nsSpecialSystemDirectory.h"
#include "nsIDirectoryService.h"
#include "nsInstall.h"
#include "nsSoftwareUpdateIIDs.h"
@@ -126,9 +126,25 @@ nsSoftwareUpdate::nsSoftwareUpdate()
/***************************************/
NR_StartupRegistry(); /* startup the registry; if already started, this will essentially be a noop */
nsSpecialSystemDirectory appDir(nsSpecialSystemDirectory::OS_CurrentProcessDirectory);
VR_SetRegDirectory( appDir.GetNativePathCString() );
nsresult rv;
NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_PROGID, &rv);
if(!directoryService) return;
nsCOMPtr<nsILocalFile> dir;
directoryService->Get("xpcom.currentProcess", NS_GET_IID(nsIFile), getter_AddRefs(dir));
if (dir)
{
char* nativePath;
dir->GetPath(&nativePath);
// EVIL version registry does not take a nsIFile.;
VR_SetRegDirectory( nativePath );
if (nativePath)
nsAllocator::Free(nativePath);
}
}