home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2004 April
/
Chip_2004-04_cd1.bin
/
tema
/
mozilla
/
skin
/
ieskin-0.0.3-IE5.5-skinVersion1.5.xpi
/
install.js
< prev
next >
Wrap
Text File
|
2004-01-16
|
4KB
|
130 lines
var fileName = "ieskin";
var themeName = "Internet Explorer 5.5 Skin";
var themeVersion = "0.0.3";
// this function verifies disk space in kilobytes
function verifyDiskSpace(dirPath, spaceRequired)
{
var spaceAvailable;
// Get the available disk space on the given path
spaceAvailable = fileGetDiskSpaceAvailable(dirPath);
// Convert the available disk space into kilobytes
spaceAvailable = parseInt(spaceAvailable / 1024);
// do the verification
if(spaceAvailable < spaceRequired)
{
logComment("Insufficient disk space: " + dirPath);
logComment(" required : " + spaceRequired + " K");
logComment(" available: " + spaceAvailable + " K");
return(false);
}
return(true);
}
var srDest = 300;
var err;
var fChrome;
var chromeNode = themeName + "/" + themeVersion;
// --- END LOCALIZABLE RESOURCES ---
var regName = "skins/mozilla/" + chromeNode;
var chromeName = fileName + ".jar";
err = initInstall(themeName, regName, themeVersion);
logComment("initInstall: " + err);
var messages = loadResources("install.properties");
fChrome = getFolder("Chrome");
logComment("fChrome: " + fChrome);
if (verifyDiskSpace(fChrome, srDest))
{
var chromeType = SKIN;
if (confirm(messages.install_opt_en))
{
logComment("attempting to install globally");
err = addFile(themeName, chromeName, fChrome, "");
logComment("addFile() returned: " + err);
if (err != SUCCESS)
{
logComment("addFile() to " + fChrome + "failed!");
// couldn't install globally, try installing to the profile
resetError();
chromeType |= PROFILE_CHROME;
fChrome = getFolder(getFolder("Profile"),"chrome");
logComment("try installing to the user profile:" + fChrome);
err = addFile(themeName, chromeName, fChrome, "");
}
}
else
{
logComment("attempting to install locally");
chromeType |= PROFILE_CHROME;
fChrome = getFolder(getFolder("Profile"),"chrome");
err = addFile(themeName, chromeName, fChrome, "");
}
setPackageFolder(fChrome);
// check return value
if ((err == SUCCESS) || (err == REBOOT_NEEDED))
{
var tellReboot = 0;
if (err == REBOOT_NEEDED) {
tellReboot = 1;
resetError();
}
// register chrome
var cf = getFolder(fChrome, chromeName);
registerChrome(chromeType, cf, "");
err = performInstall();
logComment("performInstall() returned: " + err);
if (err == REBOOT_NEEDED) {
tellReboot = 1;
resetError();
}
if (err == SUCCESS)
{
if (tellReboot == 1)
{
alert(themeName + " " + messages.success_reboot_en);
}
else
{
alert(themeName + " " + messages.success_en);
}
}
else
{
alert(themeName + " " + messages.fail_en + " " + err);
}
}
else
{
cancelInstall(err);
logComment("cancelInstall due to error: " + err);
if (err == -202) {
alert(themeName + " " + messages.cancel_202_en + " " + err);
}
else {
alert(themeName + " " + messages.cancel_en + " " + err);
}
}
}
else
cancelInstall(INSUFFICIENT_DISK_SPACE);