[cvs-annodex] commit (/annodex): AnnodexFirefoxExtension/trunk/Installer/install.js AnnodexFirefoxExtension/trunk/Installer/install.rdf

andre nobody at lists.annodex.net
Fri Feb 25 01:14:56 EST 2005


Update of /annodex (new revision 940)

Modified files:
   AnnodexFirefoxExtension/trunk/Installer/install.js
   AnnodexFirefoxExtension/trunk/Installer/install.rdf

Log Message:
AnnodexFirefoxExtension:
 * Added copyright notices to install.{js,rdf} files
 * Updated install.js to work on UNIX (needs regression testing on Windows)



Modified: AnnodexFirefoxExtension/trunk/Installer/install.js
===================================================================
--- AnnodexFirefoxExtension/trunk/Installer/install.js	2005-02-24 14:13:18 UTC (rev 939)
+++ AnnodexFirefoxExtension/trunk/Installer/install.js	2005-02-24 14:14:55 UTC (rev 940)
@@ -1,32 +1,123 @@
+//
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Annodex Firefox Extension.
+ *
+ * The Initial Developer of the Original Code is
+ * Commonwealth Scientific and Industrial Research Organisation (CSIRO)
+ * Australia.
+ * Portions created by the Initial Developer are Copyright (C) 2004-2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Andre Pang <andre.pang at csiro.au>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+const registeredPackageName  = "/CSIRO/AnnodexViewer/VLCMediaEngine";
+const packageVersion         = "0.2";
+
 // Initialise the installer
-var initError = initInstall("Annodex Viewer", "AFEView", "0.1");
-logComment("initInstall: " + initError);
+var initError = initInstall
+(
+  "Annodex Viewer",
+  registeredPackageName,
+  packageVersion
+);
 
-// Where are we installing to?
-var firefoxFolder = getFolder("Program");
-logComment("firefoxFolder: " + firefoxFolder);
+// What platform are we on?
+function getPlatform ()
+{
+  if (new String(getFolder("Mac System")) != null)
+    return "macosx";
+  else if (new String(getFolder("Win System")) != null)
+    return "windows";
+  else
+    return "unix";
+}
 
+// Where are we installing to?  This depends on what platform we're running on.
+var pluginsDirectory;
+if (getPlatform() == "unix")
+{
+  // On UNIX systems, the profile directory usually looks something like
+  // "$HOME/.mozilla/firefox/default.XXX/".  Plugins need to be installed to
+  // "$HOME/.mozilla/plugins"; the best solution I've found right now is to
+  // try to specify a path relative to the user's profile directory.  This
+  // is quite fragile, but, well, it should work for 99% of users ...
+  pluginsDirectory = getFolder("Profile", "../../plugins");
+}
+else if (getPlatform() == "windows")
+{
+  // Note: this will fail if the user does not have write access to the
+  // Mozilla system plugins directory!  (Typically
+  // "C:\Program Files\mozilla.org\Mozilla\Plugins")
+  pluginsDirectory = getFolder("Plugins");
+}
+else if (getPlatform() == "macosx")
+{
+  pluginsDirectory = getFolder("Profile", "../../plugins");
+}
+else
+{
+  // In the rather unlikely event we're not being installed on a Mac,
+  // Windows, or UNIX system ...
+  alert(  "You are attempting to install the Annodex Firefox extension on "
+        + "an unsupported platform.  Please email "
+	+ "annodex-dev at lists.annodex.net for assistance.");
+}
+
+logComment("Destination Plugins directory: " + pluginsDirectory);
+
 // TODO: Check disk space
 
 // Set up the target directory
-var addDirectoryError = addDirectory("Program", "0.1",
-                          "bin",          // jar source folder
-			  firefoxFolder,  // target folder
-			  "",             // target subdirectory
-			  true            // force flag
-			  );
-logComment("addDirectoryError: " + addDirectoryError);
+var addDirectoryResult = addDirectory
+(
+  registeredPackageName,
+  "0.2",
+  "bin/plugins",  		// jar source folder
+  pluginsDirectory,		// target folder
+  "",             		// target subdirectory
+  true            		// overwrite files
+);
 
 // Perform the install
-if (addDirectoryError == SUCCESS)
+if (addDirectoryResult == SUCCESS)
 {
-  var performInstallError = performInstall();
-  logComment("performInstall: " + performInstallError);
+  var performInstallResult = performInstall();
+  
+  if (performInstallResult != SUCCESS)
+    logComment("performInstall() returned: " + performInstallResult);
+
   refreshPlugins();
 }
 else
 {
   cancelInstall(addDirectoryError);
-  logComment("install failed: " + addDirectoryError);
+  logComment("addDirectory() failed: " + addDirectoryError);
 }
 

Modified: AnnodexFirefoxExtension/trunk/Installer/install.rdf
===================================================================
--- AnnodexFirefoxExtension/trunk/Installer/install.rdf	2005-02-24 14:13:18 UTC (rev 939)
+++ AnnodexFirefoxExtension/trunk/Installer/install.rdf	2005-02-24 14:14:55 UTC (rev 940)
@@ -3,6 +3,44 @@
 <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
      xmlns:em="http://www.mozilla.org/2004/em-rdf#">
 
+<!-- ***** BEGIN LICENSE BLOCK *****
+   - Version: MPL 1.1/GPL 2.0/LGPL 2.1
+   -
+   - The contents of this file are subject to the Mozilla Public License Version
+   - 1.1 (the "License"); you may not use this file except in compliance with
+   - the License. You may obtain a copy of the License at
+   - http://www.mozilla.org/MPL/
+   -
+   - Software distributed under the License is distributed on an "AS IS" basis,
+   - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+   - for the specific language governing rights and limitations under the
+   - License.
+   -
+   - The Original Code is the Annodex Firefox Extension.
+   -
+   - The Initial Developer of the Original Code is
+   - Commonwealth Scientific and Industrial Research Organisation (CSIRO)
+   - Australia.
+   - Portions created by the Initial Developer are Copyright (C) 2004-2005
+   - the Initial Developer. All Rights Reserved.
+   -
+   - Contributor(s):
+   -   Andre Pang <andre.pang at csiro.au>
+   -
+   - Alternatively, the contents of this file may be used under the terms of
+   - either the GNU General Public License Version 2 or later (the "GPL"), or
+   - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+   - in which case the provisions of the GPL or the LGPL are applicable instead
+   - of those above. If you wish to allow use of your version of this file only
+   - under the terms of either the GPL or the LGPL, and not to allow others to
+   - use your version of this file under the terms of the MPL, indicate your
+   - decision by deleting the provisions above and replace them with the notice
+   - and other provisions required by the LGPL or the GPL. If you do not delete
+   - the provisions above, a recipient may use your version of this file under
+   - the terms of any one of the MPL, the GPL or the LGPL.
+   -
+   - ***** END LICENSE BLOCK ***** -->
+   
   <Description about="urn:mozilla:install-manifest">
     <!-- properties -->
     <em:id>{B5C4CC1F-7FE4-45db-ABB2-D8EB25E5FBD9}</em:id>


-- 
andre



More information about the cvs-annodex mailing list