1 |
wakaba |
1.1 |
|
2 |
|
|
const PACKAGE_NAME = '%%package-name%%'; |
3 |
|
|
const PACKAGE_VERSION = '%%package-version%%'; |
4 |
|
|
const DISPLAY_NAME = '%%package-display-name%%'; |
5 |
|
|
|
6 |
|
|
const PACKAGE_JAR_DIRECTORY = 'chrome/'; |
7 |
|
|
const PACKAGE_JAR_FILENAME = '%%jar-filename%%'; |
8 |
|
|
var PACKAGE_CONTENT_DIR = new Array (%%jar-content-dir%%); |
9 |
|
|
var PACKAGE_LOCALE_DIR = new Array (%%jar-locale-dir%%); |
10 |
|
|
|
11 |
|
|
var err = initInstall (DISPLAY_NAME, PACKAGE_NAME, PACKAGE_VERSION); |
12 |
|
|
var messages = loadResources ('install-res.en.inf'); |
13 |
|
|
|
14 |
|
|
var contentFlag = CONTENT | DELAYED_CHROME; |
15 |
|
|
var localeFlag = LOCALE | DELAYED_CHROME; |
16 |
|
|
var UChrome = getFolder ('Chrome'); |
17 |
|
|
var existsInProfile = File.exists (getFolder (getFolder('Current User', 'chrome'), PACKAGE_JAR_DIRECTORY + PACKAGE_JAR_FILENAME)); |
18 |
|
|
|
19 |
|
|
if (existsInProfile || !confirm (messages.installToChrome)) { |
20 |
|
|
UChrome = getFolder ('Current User', 'chrome'); |
21 |
|
|
contentFlag = CONTENT | PROFILE_CHROME; |
22 |
|
|
localeFlag = LOCALE | PROFILE_CHROME; |
23 |
|
|
} |
24 |
|
|
logComment('initInstall: ' + err); |
25 |
|
|
setPackageFolder (UChrome); |
26 |
|
|
var folder = getFolder (UChrome, PACKAGE_JAR_FILENAME); |
27 |
|
|
|
28 |
|
|
resetError (); |
29 |
|
|
addFile (PACKAGE_NAME, PACKAGE_JAR_DIRECTORY + PACKAGE_JAR_FILENAME, UChrome, ''); |
30 |
|
|
err = getLastError (); |
31 |
|
|
if (err == SUCCESS || err == REBOOT_NEEDED) { |
32 |
|
|
for (var i = 0; i < PACKAGE_CONTENT_DIR.length; i++) { |
33 |
|
|
registerChrome (contentFlag, folder, PACKAGE_CONTENT_DIR[i]); |
34 |
|
|
} |
35 |
|
|
for (var i = 0; i < PACKAGE_LOCALE_DIR.length; i++) { |
36 |
|
|
registerChrome (localeFlag, folder, PACKAGE_LOCALE_DIR[i]); |
37 |
|
|
} |
38 |
|
|
} |
39 |
|
|
|
40 |
|
|
err = getLastError(); |
41 |
|
|
if (err == SUCCESS || err == REBOOT_NEEDED) { |
42 |
|
|
performInstall(); |
43 |
|
|
err = getLastError(); |
44 |
|
|
if (err == SUCCESS || err == REBOOT_NEEDED) { |
45 |
|
|
//alert("Please restart mozilla"); |
46 |
|
|
} else { |
47 |
|
|
// Nothing to do, Mozilla will display an error message himself |
48 |
|
|
} |
49 |
|
|
} else { |
50 |
|
|
cancelInstall(); |
51 |
|
|
if (err == -202) { |
52 |
|
|
alert (messages.noPermission.replace (/%s/, folder)); |
53 |
|
|
} else if (err == -210) { |
54 |
|
|
alert (messages.canceldByUser); |
55 |
|
|
}else { |
56 |
|
|
alert(messages.unknownError.replace (/%s/, err)); |
57 |
|
|
} |
58 |
|
|
} |
59 |
|
|
|
60 |
|
|
/* |
61 |
|
|
***** BEGIN LICENSE BLOCK ***** |
62 |
|
|
Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
63 |
|
|
|
64 |
|
|
The contents of this file are subject to the Mozilla Public License Version |
65 |
|
|
1.1 (the "License"); you may not use this file except in compliance with |
66 |
|
|
the License. You may obtain a copy of the License at |
67 |
|
|
<http://www.mozilla.org/MPL/> |
68 |
|
|
|
69 |
|
|
Software distributed under the License is distributed on an "AS IS" basis, |
70 |
|
|
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
71 |
|
|
for the specific language governing rights and limitations under the |
72 |
|
|
License. |
73 |
|
|
|
74 |
|
|
The Initial Developer is Wakaba <w@suika.fam.cx>. |
75 |
|
|
Portions created by the Initial Developer are Copyright (C) 2003 |
76 |
|
|
the Initial Developer. All Rights Reserved. |
77 |
|
|
|
78 |
|
|
Contributor(s): |
79 |
|
|
Wakaba <w@suika.fam.cx> (original author) |
80 |
|
|
|
81 |
|
|
Alternatively, the contents of this file may be used under the terms of |
82 |
|
|
either the GNU General Public License Version 2 or later (the "GPL"), or |
83 |
|
|
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
84 |
|
|
in which case the provisions of the GPL or the LGPL are applicable instead |
85 |
|
|
of those above. If you wish to allow use of your version of this file only |
86 |
|
|
under the terms of either the GPL or the LGPL, and not to allow others to |
87 |
|
|
use your version of this file under the terms of the MPL, indicate your |
88 |
|
|
decision by deleting the provisions above and replace them with the notice |
89 |
|
|
and other provisions required by the GPL or the LGPL. If you do not delete |
90 |
|
|
the provisions above, a recipient may use your version of this file under |
91 |
|
|
the terms of any one of the MPL, the GPL or the LGPL. |
92 |
|
|
|
93 |
|
|
***** END LICENSE BLOCK ***** |
94 |
|
|
*/ |
95 |
|
|
/* $Date: 2003/07/06 11:12:48 $ */ |