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