Mercurial > tinyurl_creator
comparison install.js @ 0:c14d52a3b2fe
initial import
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Mon, 11 Aug 2008 20:34:21 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c14d52a3b2fe |
---|---|
1 | |
2 const gName = "TinyUrl Creator"; | |
3 const gAuthor = "Jeremy Gillick"; | |
4 const gRegKey = "/JeremyGillick/TinyUrl"; | |
5 const gVersion = "1.0.5"; | |
6 const gJar = "tinyurl.jar"; | |
7 const gFolderName = "tinyurl"; | |
8 | |
9 var error = null; | |
10 var oFolder = getFolder("Current User", "chrome"); | |
11 var iContentFlag = CONTENT | PROFILE_CHROME; | |
12 | |
13 // Install in App or Profile? | |
14 var existsInApplication = File.exists(getFolder(getFolder("chrome"), gJar)); | |
15 var existsInProfile = File.exists(getFolder(oFolder, gJar)); | |
16 if(existsInApplication || (!existsInProfile && !confirm("Do you want to install the extension into your profile folder?\n(Cancel will install into the application folder)"))) | |
17 { | |
18 iContentFlag = CONTENT | DELAYED_CHROME; | |
19 oFolder = getFolder("chrome"); | |
20 } | |
21 | |
22 // Uninstall Current | |
23 if(existsInApplication || existsInProfile) | |
24 uninstall(gRegKey); | |
25 | |
26 // Init | |
27 initInstall(gName, gRegKey, gVersion); | |
28 setPackageFolder(oFolder); | |
29 error = addFile(gAuthor, gVersion, "chrome/"+ gJar, oFolder, null); | |
30 | |
31 // Register | |
32 if(error == SUCCESS){ | |
33 registerChrome(iContentFlag, getFolder(oFolder, gJar), "content/"); | |
34 | |
35 error = performInstall(); //Install | |
36 | |
37 if(error != SUCCESS && error != 999){ | |
38 switch(error){ | |
39 case -215: | |
40 alert("The installation of the extension failed.\nOne of the files being overwritten is read-only."); | |
41 break; | |
42 case -235: | |
43 alert("The installation of the extension failed.\nThere is insufficient disk space."); | |
44 break; | |
45 default: | |
46 alert("The installation of the extension failed.\nThe error code is: " + error); | |
47 } | |
48 cancelInstall(error); | |
49 } | |
50 } | |
51 else{ | |
52 alert("The installation failed.\n" + error); | |
53 cancelInstall(error); | |
54 } |