commit dd665ec41f9dff4283b829a93d3b6ea5c0ef026e
parent 8c80d6acb6d12c8a6c5675d58cbdf81b9f647047
Author: Simon Kornblith <simon@simonster.com>
Date: Tue, 21 Dec 2010 19:12:17 +0000
try to load libc from libc.so.6 on Linux (since this appears to work, but loading from libc.so fails)
Diffstat:
1 file changed, 26 insertions(+), 3 deletions(-)
diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js
@@ -193,9 +193,32 @@ Zotero.Integration = new function() {
} else {
Components.utils.import("resource://gre/modules/ctypes.jsm");
- // initialize library
- var libc = Zotero.isMac ? "/usr/lib/libc.dylib" : "libc.so";
- var lib = ctypes.open(libc);
+ // get possible names for libc
+ if(Zotero.isMac) {
+ var possibleLibcs = ["/usr/lib/libc.dylib"];
+ } else {
+ var possibleLibcs = [
+ "libc.so.6",
+ "libc.so.6.1",
+ "libc.so"
+ ];
+ }
+
+ // try all possibilities
+ while(possibleLibcs.length) {
+ var libc = possibleLibcs.shift();
+ try {
+ var lib = ctypes.open(libc);
+ break;
+ } catch(e) {}
+ }
+
+ // throw appropriate error on failure
+ if(!lib) {
+ throw "libc could not be loaded. Please post on the Zotero Forums so we can add "+
+ "support for your operating system.";
+ }
+
// int mkfifo(const char *path, mode_t mode);
var mkfifo = lib.declare("mkfifo", ctypes.default_abi, ctypes.int, ctypes.char.ptr, ctypes.unsigned_int);