commit 517ca6f342eeb5bcc0c1a58cf787ee27573575f9
parent 5b09b1e2bec2c18844e61752333a783bb4bb6b0a
Author: Simon Kornblith <simon@simonster.com>
Date: Wed, 7 Aug 2013 17:42:15 -0400
Force quit after zapping cache files to prevent destroying prefs
Diffstat:
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/chrome/content/zotero/standalone/standalone.js b/chrome/content/zotero/standalone/standalone.js
@@ -157,18 +157,23 @@ const ZoteroStandalone = new function() {
getService(Components.interfaces.nsIEnvironment);
var user = env.get("USER") || env.get("USERNAME");
if(user === "root") {
- // Zap cache files
- try {
- Services.dirsvc.get("ProfLD", Components.interfaces.nsIFile).remove(true);
- } catch(e) {}
- // Warn user never to do this again
+ // Show warning
if(Services.prompt.confirmEx(null, "", Zotero.getString("standalone.rootWarning"),
Services.prompt.BUTTON_POS_0*Services.prompt.BUTTON_TITLE_IS_STRING |
Services.prompt.BUTTON_POS_1*Services.prompt.BUTTON_TITLE_IS_STRING,
Zotero.getString("standalone.rootWarning.exit"),
Zotero.getString("standalone.rootWarning.continue"),
null, null, {}) == 0) {
- goQuitApplication();
+ Components.utils.import("resource://gre/modules/ctypes.jsm");
+ var exit = Zotero.IPC.getLibc().declare("exit", ctypes.default_abi,
+ ctypes.void_t, ctypes.int);
+ // Zap cache files
+ try {
+ Services.dirsvc.get("ProfLD", Components.interfaces.nsIFile).remove(true);
+ } catch(e) {}
+ // Exit Zotero without giving XULRunner the opportunity to figure out the
+ // cache is missing. Otherwise XULRunner will zap the prefs
+ exit(0);
}
}
}