mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-14 15:37:55 +00:00
aa2073782a
bug 66851 - Cannot download over modem using new download agent r=dveditz,sgehani sr=mscott affects windows platforms only.
307 lines
12 KiB
Plaintext
307 lines
12 KiB
Plaintext
function createShortcuts()
|
|
{
|
|
var subkey;
|
|
var valname;
|
|
var szStartMenuPrograms;
|
|
var szStartMenu;
|
|
var szFolderDesktop;
|
|
var szFolderQuickLaunch;
|
|
var szFolderSendTo;
|
|
var winreg;
|
|
var fWindows;
|
|
var fTemp;
|
|
var fProgram;
|
|
var fileExe;
|
|
var scExeDesc;
|
|
var scProfileDesc;
|
|
var scProfileDescParam;
|
|
var scFolderName;
|
|
var fFolderDesktop;
|
|
var fFolderPath;
|
|
var fFolderPathStr;
|
|
var is_winnt;
|
|
var szCurrentVersion;
|
|
|
|
winreg = getWinRegistry();
|
|
fWindows = getFolder("Windows");
|
|
fProgram = getFolder("Program");
|
|
fTemp = fProgram + "$MainExeFile$";
|
|
fileExe = getFolder("file:///", fTemp);
|
|
scExeDesc = "$ProductName$";
|
|
scProfileDesc = "Profile Manager";
|
|
scProfileDescParam = "-ProfileManager";
|
|
scFolderName = "$ProductName$";
|
|
if(winreg != null)
|
|
{
|
|
/* determine if the script is running under NT or not */
|
|
winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
|
|
subkey = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
|
|
valname = "CurrentVersion";
|
|
szCurrentVersion = winreg.getValueString(subkey, valname);
|
|
logComment("szCurrentVersion: " + szCurrentVersion);
|
|
if((szCurrentVersion == "") || (szCurrentVersion == null))
|
|
{
|
|
is_winnt = false;
|
|
}
|
|
else
|
|
{
|
|
is_winnt = true;
|
|
}
|
|
|
|
if(is_winnt == false)
|
|
{
|
|
logComment("is_winnt is false: " + is_winnt);
|
|
|
|
winreg.setRootKey(winreg.HKEY_CURRENT_USER);
|
|
subkey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
|
|
valname = "Programs";
|
|
szStartMenuPrograms = winreg.getValueString(subkey, valname);
|
|
valname = "Start Menu";
|
|
szStartMenu = winreg.getValueString(subkey, valname);
|
|
valname = "Desktop";
|
|
szFolderDesktop = winreg.getValueString(subkey, valname);
|
|
}
|
|
else
|
|
{
|
|
logComment("is_winnt is true: " + is_winnt);
|
|
|
|
winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
|
|
subkey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
|
|
valname = "Common Programs";
|
|
szStartMenuPrograms = winreg.getValueString(subkey, valname);
|
|
valname = "Common Start Menu";
|
|
szStartMenu = winreg.getValueString(subkey, valname);
|
|
valname = "Common Desktop";
|
|
szFolderDesktop = winreg.getValueString(subkey, valname);
|
|
}
|
|
|
|
winreg.setRootKey(winreg.HKEY_CURRENT_USER);
|
|
subkey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
|
|
valname = "SendTo";
|
|
szFolderSendTo = winreg.getValueString(subkey, valname);
|
|
|
|
subkey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\GrpConv\\MapGroups";
|
|
valname = "Quick Launch";
|
|
szFolderQuickLaunch = winreg.getValueString(subkey, valname);
|
|
|
|
winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
|
|
subkey = "SOFTWARE\\$CompanyName$\\$ProductName$\\$UserAgent$\\Main";
|
|
valname = "Program Folder Path";
|
|
fFolderPathStr = winreg.getValueString(subkey, valname);
|
|
if((fFolderPathStr == "") || (fFolderPathStr == null))
|
|
{
|
|
fTemp = szStartMenuPrograms + "\\" + scFolderName;
|
|
fFolderPath = getFolder("file:///", fTemp);
|
|
}
|
|
else
|
|
{
|
|
/* convert the path string to a path folder object */
|
|
fFolderPath = getFolder("file:///", fFolderPathStr);
|
|
}
|
|
/* convert the path string to a path folder object */
|
|
fFolderDesktop = getFolder("file:///", szFolderDesktop);
|
|
|
|
logComment("Folder StartMenuPrograms: " + szStartMenuPrograms);
|
|
logComment("Folder StartMenu : " + szStartMenu);
|
|
logComment("Folder FolderDesktop : " + szFolderDesktop);
|
|
logComment("Folder FolderSendTo : " + szFolderSendTo);
|
|
logComment("Folder FolderQuickLaunch: " + szFolderQuickLaunch);
|
|
logComment("fileExe : " + fileExe);
|
|
logComment("fFolderPath : " + fFolderPath);
|
|
logComment("scExeDesc : " + scExeDesc);
|
|
logComment("fProgram : " + fProgram);
|
|
|
|
/* explicitly create the fFolderPath even though the windowsShortcut function creates the folder.
|
|
* This is so that the folder creation gets logged for uninstall to remove it. */
|
|
File.dirCreate(fFolderPath);
|
|
|
|
/* create the shortcuts */
|
|
File.windowsShortcut(fileExe, fFolderDesktop, scExeDesc, fProgram, "", fileExe, 0);
|
|
File.windowsShortcut(fileExe, fFolderPath, scExeDesc, fProgram, "", fileExe, 0);
|
|
File.windowsShortcut(fileExe, fFolderPath, scProfileDesc, fProgram, scProfileDescParam, fileExe, 0);
|
|
// File.windowsShortcut(fileExe, fFolderPath, "Test Http", "", "", "http://sweetlou/products/client/temp/ssu", 0);
|
|
|
|
/* set the Program Folder Path in the Mozilla key in the Windows Registry */
|
|
winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
|
|
subkey = "SOFTWARE\\$CompanyName$";
|
|
winreg.createKey(subkey,"");
|
|
|
|
valname = "CurrentVersion";
|
|
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 = "Program Folder Path";
|
|
value = fFolderPath;
|
|
err = winreg.setValueString(subkey, valname, value);
|
|
|
|
}
|
|
else
|
|
{
|
|
logComment("winreg is null");
|
|
}
|
|
}
|
|
|
|
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 = fProgram;
|
|
err = winreg.setValueString(subkey, valname, value);
|
|
|
|
// set the App Paths key here
|
|
subkey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\$MainExeFile$";
|
|
winreg.createKey(subkey,"");
|
|
valname = "";
|
|
value = fProgram + "$MainExeFile$";
|
|
err = winreg.setValueString(subkey, valname, value);
|
|
|
|
valname = "Path";
|
|
value = fProgram;
|
|
err = winreg.setValueString(subkey, valname, value);
|
|
}
|
|
}
|
|
|
|
// main
|
|
var srDest;
|
|
var err;
|
|
var fProgram;
|
|
var fWindowsSystem;
|
|
var fileComponentRegStr;
|
|
var fileComponentReg;
|
|
|
|
$Ren8dot3List$
|
|
|
|
srDest = $SpaceRequired$:bin;
|
|
err = initInstall("$ProductName$", "Browser", "$Version$");
|
|
logComment("initInstall: " + err);
|
|
|
|
fProgram = getFolder("Program");
|
|
fWindowsSystem = getFolder("Win System");
|
|
logComment("fProgram: " + fProgram);
|
|
|
|
if(verifyDiskSpace(fProgram, srDest))
|
|
{
|
|
setPackageFolder(fProgram);
|
|
|
|
$Ren8dot3Call$
|
|
|
|
err = addDirectory("",
|
|
"$Version$",
|
|
"bin", // dir name in jar to extract
|
|
fProgram, // Where to put this file (Returned from GetFolder)
|
|
"", // subdir name to create relative to fProgram
|
|
true); // Force Flag
|
|
logComment("addDirectory() of Program returned: " + err);
|
|
|
|
// check return value
|
|
if( err == SUCCESS )
|
|
{
|
|
updateWinReg();
|
|
createShortcuts();
|
|
// we don't want to fail on errors for the above two
|
|
resetError();
|
|
|
|
// register chrome
|
|
registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","toolkit.jar"),"content/global/");
|
|
registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","comm.jar"),"content/communicator/");
|
|
registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","comm.jar"),"content/editor/");
|
|
registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","comm.jar"),"content/navigator/");
|
|
registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","comm.jar"),"content/necko/");
|
|
registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome","classic.jar"),"skin/classic/communicator/");
|
|
registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome","classic.jar"),"skin/classic/editor/");
|
|
registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome","classic.jar"),"skin/classic/global/");
|
|
registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome","classic.jar"),"skin/classic/messenger/");
|
|
registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome","classic.jar"),"skin/classic/navigator/");
|
|
// registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome","blue.jar"),"skin/blue/communicator/");
|
|
// registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome","blue.jar"),"skin/blue/editor/");
|
|
// registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome","blue.jar"),"skin/blue/global/");
|
|
// registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome","blue.jar"),"skin/blue/messenger/");
|
|
// registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome","blue.jar"),"skin/blue/navigator/");
|
|
registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome","modern.jar"),"skin/modern/communicator/");
|
|
registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome","modern.jar"),"skin/modern/editor/");
|
|
registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome","modern.jar"),"skin/modern/global/");
|
|
registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome","modern.jar"),"skin/modern/messenger/");
|
|
registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome","modern.jar"),"skin/modern/navigator/");
|
|
|
|
|
|
/* Log files that are created after the installer is done, so they can be uninstalled */
|
|
logComment("Installing: " + fProgram + "Xpcs Registry.dat");
|
|
logComment("Installing: " + fProgram + "xpcom.log");
|
|
logComment("Create Folder: " + fProgram + "components");
|
|
logComment("Installing: " + fProgram + "components\\xpti.dat");
|
|
logComment("Installing: " + fProgram + "components\\xptitemp.dat");
|
|
logComment("Create Folder: " + fProgram + "chrome");
|
|
logComment("Installing: " + fProgram + "chrome\\installed-chrome.txt");
|
|
logComment("Installing: " + fProgram + "chrome\\all-locales.rdf");
|
|
logComment("Installing: " + fProgram + "chrome\\all-packages.rdf");
|
|
logComment("Installing: " + fProgram + "chrome\\all-skins.rdf");
|
|
logComment("Installing: " + fProgram + "chrome\\user-locales.rdf");
|
|
logComment("Installing: " + fProgram + "chrome\\user-skins.rdf");
|
|
logComment("Create Folder: " + fProgram + "chrome\\overlayinfo");
|
|
logComment("Create Folder: " + fProgram + "chrome\\overlayinfo\\communicator");
|
|
logComment("Create Folder: " + fProgram + "chrome\\overlayinfo\\editor");
|
|
logComment("Create Folder: " + fProgram + "chrome\\overlayinfo\\messenger");
|
|
logComment("Create Folder: " + fProgram + "chrome\\overlayinfo\\navigator");
|
|
logComment("Create Folder: " + fProgram + "chrome\\overlayinfo\\communicator\\content");
|
|
logComment("Installing: " + fProgram + "chrome\\overlayinfo\\communicator\\content\\overlays.rdf");
|
|
logComment("Create Folder: " + fProgram + "chrome\\overlayinfo\\editor\\content");
|
|
logComment("Installing: " + fProgram + "chrome\\overlayinfo\\editor\\content\\overlays.rdf");
|
|
logComment("Create Folder: " + fProgram + "chrome\\overlayinfo\\messenger\\content");
|
|
logComment("Installing: " + fProgram + "chrome\\overlayinfo\\messenger\\content\\overlays.rdf");
|
|
logComment("Create Folder: " + fProgram + "chrome\\overlayinfo\\navigator\\content");
|
|
logComment("Installing: " + fProgram + "chrome\\overlayinfo\\navigator\\content\\overlays.rdf");
|
|
|
|
err = getLastError();
|
|
if (err == SUCCESS)
|
|
{
|
|
err = performInstall();
|
|
logComment("performInstall() returned: " + err);
|
|
}
|
|
else
|
|
cancelInstall(err);
|
|
}
|
|
else
|
|
cancelInstall(err);
|
|
}
|
|
else
|
|
cancelInstall(INSUFFICIENT_DISK_SPACE);
|
|
|
|
|
|
// end main
|