support importing on Windows and *NIX

This commit is contained in:
Simon Kornblith 2010-09-20 02:50:24 +00:00
parent 498489f8c3
commit 50934eef0c

View file

@ -618,11 +618,30 @@ var Zotero = new function(){
// if standalone and no directory yet, check Firefox directory // if standalone and no directory yet, check Firefox directory
// or if in Firefox and no directory yet, check standalone Zotero directory // or if in Firefox and no directory yet, check standalone Zotero directory
if(!file.exists()) { if(!file.exists()) {
if(Zotero.isStandalone) {
if(Zotero.isWin) {
var path = "../Mozilla/Firefox";
} else if(Zotero.isMac) {
var path = "../Firefox";
} else {
var path = "../.mozilla/firefox";
}
} else {
if(Zotero.isWin) {
var path = "../../Zotero";
} else if(Zotero.isMac) {
var path = "../Zotero";
} else {
var path = "../../.zotero";
}
}
// get Firefox directory // get Firefox directory
var prefDir = Components.classes["@mozilla.org/file/directory_service;1"] var prefDir = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties) .getService(Components.interfaces.nsIProperties)
.get("DefProfRt", Components.interfaces.nsILocalFile).parent.parent; .get("DefProfRt", Components.interfaces.nsILocalFile).parent
prefDir.append(Zotero.isStandalone ? "Firefox" : "Zotero"); .QueryInterface(Components.interfaces.nsILocalFile);
prefDir.appendRelativePath(path);
// get default profile // get default profile
var defProfile = getDefaultProfile(prefDir); var defProfile = getDefaultProfile(prefDir);