mirror of
https://github.com/rn10950/RetroZilla.git
synced 2024-11-11 02:10:17 +01:00
47 lines
1.3 KiB
JavaScript
47 lines
1.3 KiB
JavaScript
// 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 = 111;
|
|
|
|
var err = initInstall("Component Viewer v0.5", "CView", "5.0.0.2001021601");
|
|
logComment("initInstall: " + err);
|
|
|
|
if (verifyDiskSpace(getFolder("Program"), srDest))
|
|
{
|
|
addFile("CView Chrome",
|
|
"bin/chrome/cview.jar", // jar source folder
|
|
getFolder("Chrome"), // target folder
|
|
""); // target subdir
|
|
|
|
registerChrome(PACKAGE | DELAYED_CHROME, getFolder("Chrome","cview.jar"),
|
|
"content/cview/");
|
|
registerChrome(LOCALE | DELAYED_CHROME, getFolder("Chrome","cview.jar"),
|
|
"locale/en-US/cview/");
|
|
|
|
if (err==SUCCESS)
|
|
performInstall();
|
|
else
|
|
cancelInstall(err);
|
|
}
|
|
else
|
|
cancelInstall(INSUFFICIENT_DISK_SPACE);
|