compareVersion
Compares the version of a file or package with the version of an existing file or package.
Method of
InstallTriggerSyntax
int compareVersion ( String registryName, InstallVersion version); int compareVersion ( String registryName, String version); int compareVersion ( String registryName, int major, int minor, int release, int build);Parameters
The
compareVersionmethod has the following parameters:
registryNameThe pathname in the Client Version Registry for the component whose version is to be compared. This parameter can be an absolute pathname, such as /royalairways/RoyalSWor a relative pathname, such asplugsin/royalairway/RoyalSW. Note that the registry pathname is not the location of the software on the computer; it is the location of information about the software inside the Client Version Registry.versionAn InstallVersion object containing version information or a String in the format major.minor.release.build, where major, minor, release, and build are integer values representing version information.Returns
If the versions are the same or if Software Installation is not enabled, this method returns 0. If the version of
registryNameis smaller (earlier) thanversion, this method returns a negative number. Otherwise, this method returns a positive number. In particular, this method returns one of the following values:
The following constants can be used to check the value returned by compareVersion:
int MAJOR_DIFF = 4; int MINOR_DIFF = 3; int REL_DIFF = 2; int BLD_DIFF = 1; int EQUAL = 0;In Communicator 4.5, the following constants are defined and available for checking the value returned by
compareVersion:InstallTrigger.MAJOR_DIFF InstallTrigger.MINOR_DIFF InstallTrigger.REL_DIFF InstallTrigger.BLD_DIFF InstallTrigger.EQUALDescription
The
compareVersionmethod compares the version of an installed file or package with a specified version. It is often used as a check against which to initiate the installation process.If
registryNameis not found in the Client Version Registry or ifregistryNamedoes not have version,registryNameis assumed to have a version of 0.0.0.0.If
registryNamerepresents a file,compareVersionchecks for the existence of the file. If the file has been deleted, its version is assumed to be 0.0.0.0.
| Netscape Communications devedge.netscape.com |