1999-03-23 22:55:00 +00:00
|
|
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
1999-02-05 00:15:30 +00:00
|
|
|
/*
|
1999-11-06 03:43:54 +00:00
|
|
|
* The contents of this file are subject to the Netscape Public
|
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.mozilla.org/NPL/
|
1999-02-05 00:15:30 +00:00
|
|
|
*
|
1999-11-06 03:43:54 +00:00
|
|
|
* Software distributed under the License is distributed on an "AS
|
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
1999-02-05 00:15:30 +00:00
|
|
|
*
|
1999-03-23 22:55:00 +00:00
|
|
|
* The Original Code is Mozilla Communicator client code,
|
|
|
|
* released March 31, 1998.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape Communications
|
1999-11-06 03:43:54 +00:00
|
|
|
* Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
1999-03-23 22:55:00 +00:00
|
|
|
*
|
1999-11-06 03:43:54 +00:00
|
|
|
* Contributor(s):
|
1999-03-23 22:55:00 +00:00
|
|
|
* Daniel Veditz <dveditz@netscape.com>
|
|
|
|
* Douglas Turner <dougt@netscape.com>
|
1999-02-05 00:15:30 +00:00
|
|
|
*/
|
|
|
|
|
1999-12-08 05:09:17 +00:00
|
|
|
#include "prprf.h"
|
1999-03-23 22:55:00 +00:00
|
|
|
#include "nsInstallFile.h"
|
1999-02-05 22:27:08 +00:00
|
|
|
#include "nsFileSpec.h"
|
1999-02-05 00:15:30 +00:00
|
|
|
#include "VerReg.h"
|
1999-03-23 22:55:00 +00:00
|
|
|
#include "ScheduledTasks.h"
|
1999-02-22 23:10:23 +00:00
|
|
|
#include "nsInstall.h"
|
1999-05-27 21:02:57 +00:00
|
|
|
#include "nsIDOMInstallVersion.h"
|
1999-05-07 00:05:54 +00:00
|
|
|
#include "nsInstallResources.h"
|
1999-02-05 00:15:30 +00:00
|
|
|
|
|
|
|
/* Public Methods */
|
|
|
|
|
|
|
|
/* Constructor
|
|
|
|
inInstall - softUpdate object we belong to
|
|
|
|
inComponentName - full path of the registry component
|
|
|
|
inVInfo - full version info
|
|
|
|
inJarLocation - location inside the JAR file
|
|
|
|
inFinalFileSpec - final location on disk
|
|
|
|
*/
|
1999-05-27 21:02:57 +00:00
|
|
|
|
1999-11-21 06:03:23 +00:00
|
|
|
MOZ_DECL_CTOR_COUNTER(nsInstallFile);
|
1999-05-27 21:02:57 +00:00
|
|
|
|
1999-02-22 23:10:23 +00:00
|
|
|
nsInstallFile::nsInstallFile(nsInstall* inInstall,
|
1999-03-09 00:50:23 +00:00
|
|
|
const nsString& inComponentName,
|
1999-05-27 21:02:57 +00:00
|
|
|
const nsString& inVInfo,
|
1999-02-05 00:15:30 +00:00
|
|
|
const nsString& inJarLocation,
|
1999-11-21 06:03:23 +00:00
|
|
|
nsInstallFolder *folderSpec,
|
1999-02-05 00:15:30 +00:00
|
|
|
const nsString& inPartialPath,
|
2000-03-22 21:51:26 +00:00
|
|
|
PRInt32 mode,
|
1999-02-05 22:27:08 +00:00
|
|
|
PRInt32 *error)
|
1999-12-08 05:09:17 +00:00
|
|
|
: nsInstallObject(inInstall),
|
|
|
|
mVersionInfo(nsnull),
|
|
|
|
mJarLocation(nsnull),
|
|
|
|
mExtractedFile(nsnull),
|
|
|
|
mFinalFile(nsnull),
|
|
|
|
mVersionRegistryName(nsnull),
|
2000-03-22 21:51:26 +00:00
|
|
|
mMode(mode),
|
1999-12-08 05:09:17 +00:00
|
|
|
mReplaceFile(PR_FALSE),
|
|
|
|
mChildFile(PR_TRUE),
|
|
|
|
mUpgradeFile(PR_FALSE),
|
|
|
|
mSkipInstall(PR_FALSE)
|
1999-02-05 00:15:30 +00:00
|
|
|
{
|
1999-11-21 06:03:23 +00:00
|
|
|
MOZ_COUNT_CTOR(nsInstallFile);
|
|
|
|
|
|
|
|
if ((folderSpec == nsnull) || (inInstall == NULL))
|
1999-02-05 00:15:30 +00:00
|
|
|
{
|
1999-03-01 21:35:13 +00:00
|
|
|
*error = nsInstall::INVALID_ARGUMENTS;
|
1999-02-05 00:15:30 +00:00
|
|
|
return;
|
|
|
|
}
|
1999-05-27 21:02:57 +00:00
|
|
|
|
1999-12-08 05:09:17 +00:00
|
|
|
*error = nsInstall::SUCCESS;
|
|
|
|
|
1999-05-27 21:02:57 +00:00
|
|
|
/* Check for existence of the newer version */
|
2000-02-20 03:12:59 +00:00
|
|
|
#if 0 // XXX need to re-implement force mode in the opposite sense
|
2000-03-22 21:51:26 +00:00
|
|
|
|
1999-05-27 21:02:57 +00:00
|
|
|
char* qualifiedRegNameString = inComponentName.ToNewCString();
|
|
|
|
|
1999-12-08 05:09:17 +00:00
|
|
|
// --------------------------------------------------------------------
|
|
|
|
// we always install if forceInstall is true, or the new file's
|
|
|
|
// version is null, or the file doesn't previously exist.
|
|
|
|
//
|
|
|
|
// IFF it's not force, AND the new file has a version, AND it's been
|
|
|
|
// previously installed, THEN we have to do the version comparing foo.
|
|
|
|
// --------------------------------------------------------------------
|
2000-03-22 21:51:26 +00:00
|
|
|
if ( !(mode & INSTALL_NO_COMPARE ) && (inVInfo != "") &&
|
|
|
|
( VR_ValidateComponent( qualifiedRegNameString ) == 0 ) )
|
1999-05-27 21:02:57 +00:00
|
|
|
{
|
|
|
|
nsInstallVersion *newVersion = new nsInstallVersion();
|
1999-07-18 20:56:12 +00:00
|
|
|
|
|
|
|
if (newVersion == nsnull)
|
|
|
|
{
|
1999-09-22 04:43:03 +00:00
|
|
|
Recycle(qualifiedRegNameString);
|
1999-07-18 20:56:12 +00:00
|
|
|
*error = nsInstall::OUT_OF_MEMORY;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1999-05-27 21:02:57 +00:00
|
|
|
newVersion->Init(inVInfo);
|
|
|
|
|
|
|
|
VERSION versionStruct;
|
|
|
|
|
|
|
|
VR_GetVersion( qualifiedRegNameString, &versionStruct );
|
|
|
|
|
|
|
|
nsInstallVersion* oldVersion = new nsInstallVersion();
|
1999-07-18 20:56:12 +00:00
|
|
|
|
2000-01-28 23:22:58 +00:00
|
|
|
if (oldVersion == nsnull)
|
1999-07-18 20:56:12 +00:00
|
|
|
{
|
1999-09-22 04:43:03 +00:00
|
|
|
Recycle(qualifiedRegNameString);
|
1999-07-18 20:56:12 +00:00
|
|
|
delete oldVersion;
|
|
|
|
*error = nsInstall::OUT_OF_MEMORY;
|
|
|
|
return;
|
|
|
|
}
|
1999-05-27 21:02:57 +00:00
|
|
|
|
|
|
|
oldVersion->Init(versionStruct.major,
|
|
|
|
versionStruct.minor,
|
|
|
|
versionStruct.release,
|
|
|
|
versionStruct.build);
|
|
|
|
|
|
|
|
PRInt32 areTheyEqual;
|
|
|
|
newVersion->CompareTo(oldVersion, &areTheyEqual);
|
|
|
|
|
|
|
|
delete oldVersion;
|
|
|
|
delete newVersion;
|
|
|
|
|
1999-12-08 05:09:17 +00:00
|
|
|
if ( areTheyEqual < 0 )
|
1999-05-27 21:02:57 +00:00
|
|
|
{
|
1999-12-08 05:09:17 +00:00
|
|
|
// the file to be installed is OLDER than what is on disk.
|
|
|
|
// Don't install it.
|
|
|
|
mSkipInstall = PR_TRUE;
|
1999-05-27 21:02:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-09-22 04:43:03 +00:00
|
|
|
Recycle(qualifiedRegNameString);
|
2000-02-20 03:12:59 +00:00
|
|
|
#endif
|
1999-05-27 21:02:57 +00:00
|
|
|
|
1999-11-21 06:03:23 +00:00
|
|
|
nsFileSpec* tmp = folderSpec->GetFileSpec();
|
|
|
|
if (!tmp)
|
|
|
|
{
|
|
|
|
*error = nsInstall::INVALID_ARGUMENTS;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
mFinalFile = new nsFileSpec(*tmp);
|
1999-07-18 20:56:12 +00:00
|
|
|
if (mFinalFile == nsnull)
|
|
|
|
{
|
|
|
|
*error = nsInstall::OUT_OF_MEMORY;
|
|
|
|
return;
|
|
|
|
}
|
1999-11-21 06:03:23 +00:00
|
|
|
|
1999-07-03 19:00:45 +00:00
|
|
|
if ( mFinalFile->Exists() )
|
|
|
|
{
|
|
|
|
// is there a file with the same name as the proposed folder?
|
|
|
|
if ( mFinalFile->IsFile() )
|
|
|
|
{
|
|
|
|
*error = nsInstall::FILENAME_ALREADY_USED;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// else this directory already exists, so do nothing
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* the nsFileSpecMac.cpp operator += requires "this" (the nsFileSpec)
|
|
|
|
* to be an existing dir
|
|
|
|
*/
|
1999-07-14 19:49:50 +00:00
|
|
|
int dirPermissions = 0755; // std default for UNIX, ignored otherwise
|
1999-07-03 19:00:45 +00:00
|
|
|
mFinalFile->CreateDir(dirPermissions);
|
|
|
|
}
|
|
|
|
|
1999-03-09 00:50:23 +00:00
|
|
|
*mFinalFile += inPartialPath;
|
|
|
|
|
1999-05-27 21:02:57 +00:00
|
|
|
mReplaceFile = mFinalFile->Exists();
|
|
|
|
|
|
|
|
if (mReplaceFile == PR_FALSE)
|
|
|
|
{
|
1999-07-03 19:00:45 +00:00
|
|
|
/* although it appears that we are creating the dir _again_ it is necessary
|
|
|
|
* when inPartialPath has arbitrary levels of nested dirs before the leaf
|
|
|
|
*/
|
1999-05-27 21:02:57 +00:00
|
|
|
nsFileSpec parent;
|
|
|
|
mFinalFile->GetParent(parent);
|
|
|
|
nsFileSpec makeDirs(parent.GetCString(), PR_TRUE);
|
|
|
|
}
|
1999-05-07 00:05:54 +00:00
|
|
|
|
1999-03-09 00:50:23 +00:00
|
|
|
mVersionRegistryName = new nsString(inComponentName);
|
1999-02-05 00:15:30 +00:00
|
|
|
mJarLocation = new nsString(inJarLocation);
|
1999-05-27 21:02:57 +00:00
|
|
|
mVersionInfo = new nsString(inVInfo);
|
1999-07-18 20:56:12 +00:00
|
|
|
|
|
|
|
if (mVersionRegistryName == nsnull ||
|
|
|
|
mJarLocation == nsnull ||
|
|
|
|
mVersionInfo == nsnull )
|
|
|
|
{
|
|
|
|
*error = nsInstall::OUT_OF_MEMORY;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1999-02-05 00:15:30 +00:00
|
|
|
nsString regPackageName;
|
|
|
|
mInstall->GetRegPackageName(regPackageName);
|
|
|
|
|
|
|
|
// determine Child status
|
|
|
|
if ( regPackageName == "" )
|
|
|
|
{
|
|
|
|
// in the "current communicator package" absolute pathnames (start
|
|
|
|
// with slash) indicate shared files -- all others are children
|
|
|
|
mChildFile = ( mVersionRegistryName->CharAt(0) != '/' );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1999-12-08 05:09:17 +00:00
|
|
|
mChildFile = mVersionRegistryName->Equals( regPackageName,
|
|
|
|
PR_FALSE,
|
|
|
|
regPackageName.Length() );
|
1999-02-05 00:15:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nsInstallFile::~nsInstallFile()
|
|
|
|
{
|
1999-03-02 20:25:42 +00:00
|
|
|
if (mVersionRegistryName)
|
|
|
|
delete mVersionRegistryName;
|
|
|
|
|
|
|
|
if (mJarLocation)
|
|
|
|
delete mJarLocation;
|
|
|
|
|
1999-12-08 05:09:17 +00:00
|
|
|
if (mExtractedFile)
|
|
|
|
delete mExtractedFile;
|
1999-03-02 20:25:42 +00:00
|
|
|
|
|
|
|
if (mFinalFile)
|
|
|
|
delete mFinalFile;
|
|
|
|
|
|
|
|
if (mVersionInfo)
|
|
|
|
delete mVersionInfo;
|
1999-11-21 06:03:23 +00:00
|
|
|
|
|
|
|
MOZ_COUNT_DTOR(nsInstallFile);
|
1999-02-05 00:15:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Prepare
|
1999-03-09 00:50:23 +00:00
|
|
|
* Extracts file out of the JAR archive
|
1999-02-05 00:15:30 +00:00
|
|
|
*/
|
1999-02-05 22:27:08 +00:00
|
|
|
PRInt32 nsInstallFile::Prepare()
|
1999-02-05 00:15:30 +00:00
|
|
|
{
|
1999-12-08 05:09:17 +00:00
|
|
|
if (mSkipInstall)
|
|
|
|
return nsInstall::SUCCESS;
|
|
|
|
|
2000-01-28 23:22:58 +00:00
|
|
|
if (mInstall == nsnull || mFinalFile == nsnull || mJarLocation == nsnull )
|
|
|
|
return nsInstall::INVALID_ARGUMENTS;
|
|
|
|
|
1999-12-08 05:09:17 +00:00
|
|
|
return mInstall->ExtractFileFromJar(*mJarLocation, mFinalFile, &mExtractedFile);
|
1999-02-05 00:15:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Complete
|
|
|
|
* Completes the install:
|
|
|
|
* - move the downloaded file to the final location
|
|
|
|
* - updates the registry
|
|
|
|
*/
|
1999-02-05 22:27:08 +00:00
|
|
|
PRInt32 nsInstallFile::Complete()
|
1999-02-05 00:15:30 +00:00
|
|
|
{
|
1999-02-22 23:10:23 +00:00
|
|
|
PRInt32 err;
|
1999-02-05 00:15:30 +00:00
|
|
|
|
1999-03-09 00:50:23 +00:00
|
|
|
if (mInstall == nsnull || mVersionRegistryName == nsnull || mFinalFile == nsnull )
|
1999-02-05 00:15:30 +00:00
|
|
|
{
|
1999-03-01 21:35:13 +00:00
|
|
|
return nsInstall::INVALID_ARGUMENTS;
|
1999-02-05 00:15:30 +00:00
|
|
|
}
|
1999-12-08 05:09:17 +00:00
|
|
|
|
|
|
|
if (mSkipInstall)
|
|
|
|
return nsInstall::SUCCESS;
|
1999-02-05 00:15:30 +00:00
|
|
|
|
1999-03-09 00:50:23 +00:00
|
|
|
err = CompleteFileMove();
|
1999-02-05 00:15:30 +00:00
|
|
|
|
1999-03-01 21:35:13 +00:00
|
|
|
if ( 0 == err || nsInstall::REBOOT_NEEDED == err )
|
1999-02-05 00:15:30 +00:00
|
|
|
{
|
2000-02-20 03:12:59 +00:00
|
|
|
// XXX Don't register individual files for now -- crucial performance
|
|
|
|
// speed up on the Mac, and we'll switch uninstall schemes after beta
|
|
|
|
|
|
|
|
// RegisterInVersionRegistry();
|
1999-02-05 00:15:30 +00:00
|
|
|
}
|
1999-02-05 22:27:08 +00:00
|
|
|
|
1999-03-09 00:50:23 +00:00
|
|
|
return err;
|
|
|
|
|
1999-02-05 00:15:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void nsInstallFile::Abort()
|
|
|
|
{
|
1999-12-08 05:09:17 +00:00
|
|
|
if (mExtractedFile != nsnull)
|
|
|
|
mExtractedFile->Delete(PR_FALSE);
|
1999-02-05 00:15:30 +00:00
|
|
|
}
|
|
|
|
|
1999-12-08 05:09:17 +00:00
|
|
|
#define RESBUFSIZE 1024
|
1999-08-25 01:26:11 +00:00
|
|
|
char* nsInstallFile::toString()
|
1999-02-05 00:15:30 +00:00
|
|
|
{
|
1999-12-08 05:09:17 +00:00
|
|
|
char* buffer = new char[RESBUFSIZE];
|
|
|
|
char* rsrcVal = nsnull;
|
|
|
|
const char* fname = nsnull;
|
1999-07-18 20:56:12 +00:00
|
|
|
|
1999-09-21 08:46:10 +00:00
|
|
|
if (buffer == nsnull || !mInstall)
|
|
|
|
return nsnull;
|
1999-12-08 05:09:17 +00:00
|
|
|
else
|
|
|
|
buffer[0] = '\0';
|
1999-09-21 08:46:10 +00:00
|
|
|
|
1999-12-08 05:09:17 +00:00
|
|
|
if (mReplaceFile)
|
1999-05-07 00:05:54 +00:00
|
|
|
{
|
1999-12-08 05:09:17 +00:00
|
|
|
rsrcVal = mInstall->GetResourcedString("ReplaceFile");
|
1999-05-07 00:05:54 +00:00
|
|
|
}
|
1999-12-08 05:09:17 +00:00
|
|
|
else if (mSkipInstall)
|
1999-05-07 00:05:54 +00:00
|
|
|
{
|
1999-12-08 05:09:17 +00:00
|
|
|
rsrcVal = mInstall->GetResourcedString("SkipFile");
|
1999-05-07 00:05:54 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1999-09-21 08:46:10 +00:00
|
|
|
rsrcVal = mInstall->GetResourcedString("InstallFile");
|
1999-12-08 05:09:17 +00:00
|
|
|
}
|
1999-09-21 08:46:10 +00:00
|
|
|
|
1999-12-08 05:09:17 +00:00
|
|
|
if (rsrcVal)
|
|
|
|
{
|
|
|
|
if (mFinalFile)
|
|
|
|
fname = mFinalFile->GetCString();
|
|
|
|
|
|
|
|
PR_snprintf( buffer, RESBUFSIZE, rsrcVal, fname );
|
|
|
|
|
|
|
|
Recycle(rsrcVal);
|
1999-05-07 00:05:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return buffer;
|
1999-02-05 00:15:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-03-09 00:50:23 +00:00
|
|
|
PRInt32 nsInstallFile::CompleteFileMove()
|
1999-02-05 00:15:30 +00:00
|
|
|
{
|
|
|
|
int result = 0;
|
|
|
|
|
1999-12-08 05:09:17 +00:00
|
|
|
if (mExtractedFile == nsnull)
|
1999-02-05 00:15:30 +00:00
|
|
|
{
|
1999-12-08 05:09:17 +00:00
|
|
|
return nsInstall::UNEXPECTED_ERROR;
|
1999-02-05 00:15:30 +00:00
|
|
|
}
|
1999-03-09 00:50:23 +00:00
|
|
|
|
1999-12-08 05:09:17 +00:00
|
|
|
if ( *mExtractedFile == *mFinalFile )
|
1999-02-05 00:15:30 +00:00
|
|
|
{
|
|
|
|
/* No need to rename, they are the same */
|
1999-12-08 05:09:17 +00:00
|
|
|
result = nsInstall::SUCCESS;
|
1999-02-05 00:15:30 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1999-12-08 05:09:17 +00:00
|
|
|
result = ReplaceFileNowOrSchedule(*mExtractedFile, *mFinalFile );
|
1999-02-05 00:15:30 +00:00
|
|
|
}
|
|
|
|
|
1999-03-09 00:50:23 +00:00
|
|
|
return result;
|
|
|
|
}
|
1999-02-05 00:15:30 +00:00
|
|
|
|
1999-03-09 00:50:23 +00:00
|
|
|
PRInt32
|
|
|
|
nsInstallFile::RegisterInVersionRegistry()
|
|
|
|
{
|
|
|
|
int refCount;
|
|
|
|
nsString regPackageName;
|
|
|
|
mInstall->GetRegPackageName(regPackageName);
|
|
|
|
|
|
|
|
|
|
|
|
// Register file and log for Uninstall
|
|
|
|
|
|
|
|
if (!mChildFile)
|
1999-02-05 00:15:30 +00:00
|
|
|
{
|
1999-03-09 00:50:23 +00:00
|
|
|
int found;
|
|
|
|
if (regPackageName != "")
|
1999-02-05 00:15:30 +00:00
|
|
|
{
|
1999-05-07 00:05:54 +00:00
|
|
|
found = VR_UninstallFileExistsInList( (char*)(const char*)nsAutoCString(regPackageName) ,
|
|
|
|
(char*)(const char*)nsAutoCString(*mVersionRegistryName));
|
1999-02-05 00:15:30 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1999-05-07 00:05:54 +00:00
|
|
|
found = VR_UninstallFileExistsInList( "", (char*)(const char*)nsAutoCString(*mVersionRegistryName) );
|
1999-02-05 00:15:30 +00:00
|
|
|
}
|
1999-03-09 00:50:23 +00:00
|
|
|
|
|
|
|
if (found != REGERR_OK)
|
|
|
|
mUpgradeFile = PR_FALSE;
|
|
|
|
else
|
|
|
|
mUpgradeFile = PR_TRUE;
|
|
|
|
}
|
1999-05-07 00:05:54 +00:00
|
|
|
else if (REGERR_OK == VR_InRegistry( (char*)(const char*)nsAutoCString(*mVersionRegistryName)))
|
1999-03-09 00:50:23 +00:00
|
|
|
{
|
|
|
|
mUpgradeFile = PR_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mUpgradeFile = PR_FALSE;
|
1999-02-05 00:15:30 +00:00
|
|
|
}
|
|
|
|
|
1999-05-07 00:05:54 +00:00
|
|
|
if ( REGERR_OK != VR_GetRefCount( (char*)(const char*)nsAutoCString(*mVersionRegistryName), &refCount ))
|
1999-03-09 00:50:23 +00:00
|
|
|
{
|
|
|
|
refCount = 0;
|
|
|
|
}
|
1999-02-05 00:15:30 +00:00
|
|
|
|
1999-05-07 00:05:54 +00:00
|
|
|
VR_Install( (char*)(const char*)nsAutoCString(*mVersionRegistryName),
|
1999-05-27 21:02:57 +00:00
|
|
|
(char*)(const char*)mFinalFile->GetNativePathCString(), // DO NOT CHANGE THIS.
|
|
|
|
(char*)(const char*)nsAutoCString(*mVersionInfo),
|
1999-05-07 00:05:54 +00:00
|
|
|
PR_FALSE );
|
|
|
|
|
1999-05-27 21:02:57 +00:00
|
|
|
if (mUpgradeFile)
|
|
|
|
{
|
|
|
|
if (refCount == 0)
|
|
|
|
VR_SetRefCount( (char*)(const char*)nsAutoCString(*mVersionRegistryName), 1 );
|
|
|
|
else
|
|
|
|
VR_SetRefCount( (char*)(const char*)nsAutoCString(*mVersionRegistryName), refCount ); //FIX?? what should the ref count be/
|
|
|
|
}
|
|
|
|
else
|
1999-03-09 00:50:23 +00:00
|
|
|
{
|
|
|
|
if (refCount != 0)
|
|
|
|
{
|
1999-05-07 00:05:54 +00:00
|
|
|
VR_SetRefCount( (char*)(const char*)nsAutoCString(*mVersionRegistryName), refCount + 1 );
|
1999-03-09 00:50:23 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1999-05-27 21:02:57 +00:00
|
|
|
if (mReplaceFile)
|
1999-05-07 00:05:54 +00:00
|
|
|
VR_SetRefCount( (char*)(const char*)nsAutoCString(*mVersionRegistryName), 2 );
|
1999-03-09 00:50:23 +00:00
|
|
|
else
|
1999-05-07 00:05:54 +00:00
|
|
|
VR_SetRefCount( (char*)(const char*)nsAutoCString(*mVersionRegistryName), 1 );
|
1999-03-09 00:50:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !mChildFile && !mUpgradeFile )
|
|
|
|
{
|
|
|
|
if (regPackageName != "")
|
1999-05-07 00:05:54 +00:00
|
|
|
{
|
|
|
|
VR_UninstallAddFileToList( (char*)(const char*)nsAutoCString(regPackageName),
|
|
|
|
(char*)(const char*)nsAutoCString(*mVersionRegistryName));
|
1999-03-09 00:50:23 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1999-05-07 00:05:54 +00:00
|
|
|
VR_UninstallAddFileToList( "", (char*)(const char*)nsAutoCString(*mVersionRegistryName) );
|
1999-03-09 00:50:23 +00:00
|
|
|
}
|
|
|
|
}
|
1999-02-05 00:15:30 +00:00
|
|
|
|
1999-03-09 00:50:23 +00:00
|
|
|
return nsInstall::SUCCESS;
|
1999-02-05 00:15:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* CanUninstall
|
|
|
|
* InstallFile() installs files which can be uninstalled,
|
|
|
|
* hence this function returns true.
|
|
|
|
*/
|
|
|
|
PRBool
|
|
|
|
nsInstallFile::CanUninstall()
|
|
|
|
{
|
1999-09-04 20:25:38 +00:00
|
|
|
return PR_TRUE;
|
1999-02-05 00:15:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* RegisterPackageNode
|
|
|
|
* InstallFile() installs files which need to be registered,
|
|
|
|
* hence this function returns true.
|
|
|
|
*/
|
|
|
|
PRBool
|
|
|
|
nsInstallFile::RegisterPackageNode()
|
|
|
|
{
|
1999-09-04 20:25:38 +00:00
|
|
|
return PR_TRUE;
|
1999-02-05 00:15:30 +00:00
|
|
|
}
|