2000-04-19 04:51:00 +04:00
|
|
|
function updateWinReg()
|
|
|
|
{
|
|
|
|
//Notes:
|
|
|
|
// can't use a double backslash before subkey - Windows already puts it in.
|
|
|
|
// subkeys have to exist before values can be put in.
|
|
|
|
var winreg = getWinRegistry();
|
|
|
|
var subkey; //the name of the subkey you are poking around in
|
|
|
|
var valname; // the name of the value you want to look at
|
|
|
|
var value; //the data in the value you want to look at.
|
|
|
|
|
|
|
|
if(winreg != null)
|
|
|
|
{
|
|
|
|
winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
|
|
|
|
subkey = "SOFTWARE\\$CompanyName$";
|
|
|
|
winreg.createKey(subkey,"");
|
|
|
|
|
|
|
|
subkey = "SOFTWARE\\$CompanyName$\\$ProductName$";
|
|
|
|
winreg.createKey(subkey,"");
|
|
|
|
|
|
|
|
valname = "CurrentVersion";
|
|
|
|
value = "$UserAgent$";
|
|
|
|
err = winreg.setValueString(subkey, valname, value);
|
|
|
|
|
|
|
|
subkey = "SOFTWARE\\$CompanyName$\\$ProductName$\\$UserAgent$";
|
|
|
|
winreg.createKey(subkey,"");
|
|
|
|
|
|
|
|
subkey = "SOFTWARE\\$CompanyName$\\$ProductName$\\$UserAgent$\\Main";
|
|
|
|
winreg.createKey(subkey,"");
|
|
|
|
|
|
|
|
valname = "Install Directory";
|
|
|
|
value = fCommunicator;
|
|
|
|
err = winreg.setValueString(subkey, valname, value);
|
|
|
|
|
|
|
|
subkey = "SOFTWARE\\$CompanyName$\\$ProductName$\\$UserAgent$\\Uninstall";
|
|
|
|
winreg.createKey(subkey,"");
|
|
|
|
|
|
|
|
valname = "Uninstall Log Folder";
|
|
|
|
value = szUninstall;
|
|
|
|
err = winreg.setValueString(subkey, valname, value);
|
|
|
|
|
|
|
|
valname = "Description";
|
|
|
|
value = "$ProductName$ $UserAgentShort$";
|
|
|
|
err = winreg.setValueString(subkey, valname, value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// main
|
|
|
|
var srDest;
|
|
|
|
var err;
|
|
|
|
var szUninstall;
|
|
|
|
var fUninstall;
|
|
|
|
var fCommunicator;
|
|
|
|
var fWindowsSystem;
|
|
|
|
var fileComponentReg;
|
|
|
|
var fileComponentRegStr;
|
|
|
|
|
|
|
|
srDest = $SpaceRequired$:bin;
|
|
|
|
err = startInstall("Mozilla XPCom", "XPCom", "$Version$");
|
|
|
|
logComment("startInstall: " + err);
|
|
|
|
|
|
|
|
fCommunicator = getFolder("Communicator");
|
|
|
|
fWindowsSystem = getFolder("Win System");
|
|
|
|
logComment("fCommunicator: " + fCommunicator);
|
|
|
|
|
|
|
|
// build the uninstall folder path
|
2000-04-21 22:58:41 +04:00
|
|
|
szUninstall = fCommunicator + "Uninstall";
|
2000-04-19 04:51:00 +04:00
|
|
|
fUninstall = getFolder("file:///", szUninstall);
|
|
|
|
File.dirCreate(fUninstall);
|
|
|
|
|
|
|
|
// Log component.reg and xpcom.log files so it can be deleted by
|
|
|
|
// the uninstaller.
|
|
|
|
// These two files are created after installation is done, thus
|
|
|
|
// are normally not logged for uninstall.
|
2000-04-26 09:04:21 +04:00
|
|
|
logComment("Installing: " + fCommunicator + "component.reg");
|
2000-04-19 04:51:00 +04:00
|
|
|
|
|
|
|
if(verifyDiskSpace(fCommunicator, srDest) == true)
|
|
|
|
{
|
|
|
|
setPackageFolder(fCommunicator);
|
|
|
|
err = addDirectory("",
|
|
|
|
"$Version$",
|
|
|
|
"bin", // dir name in jar to extract
|
|
|
|
fCommunicator, // Where to put this file (Returned from GetFolder)
|
|
|
|
"", // subdir name to create relative to fCommunicator
|
|
|
|
true); // Force Flag
|
|
|
|
logComment("addDirectory() of Program returned: " + err);
|
|
|
|
|
|
|
|
// check return value
|
|
|
|
if(!checkError(err))
|
|
|
|
{
|
2000-04-21 22:58:41 +04:00
|
|
|
fileComponentRegStr = fCommunicator + "component.reg";
|
2000-04-19 04:51:00 +04:00
|
|
|
fileComponentReg = getFolder("file:///", fileComponentRegStr);
|
|
|
|
err = fileDelete(fileComponentReg);
|
|
|
|
logComment("fileDelete() returned: " + err);
|
|
|
|
|
|
|
|
updateWinReg();
|
|
|
|
|
|
|
|
err = finalizeInstall();
|
|
|
|
logComment("finalizeInstall() returned: " + err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// end main
|
|
|
|
|