Display more helpful startup error if file access is denied

This commit is contained in:
Dan Stillman 2009-07-23 10:52:28 +00:00
parent eb0dae076b
commit 110800f154
3 changed files with 14 additions and 1 deletions

View file

@ -304,7 +304,9 @@ var ZoteroPane = new function()
// TODO: Add a better error page/window here with reporting
// instructions
// window.loadURI('chrome://zotero/content/error.xul');
alert(errMsg);
var pr = Components.classes["@mozilla.org/network/default-prompt;1"]
.getService(Components.interfaces.nsIPrompt);
pr.alert("", errMsg);
}
return;

View file

@ -295,6 +295,15 @@ var Zotero = new function(){
Zotero.DB.test();
}
catch (e) {
if (e.name == 'NS_ERROR_FILE_ACCESS_DENIED') {
// TODO: localize
var msg = Zotero.localeJoin([
Zotero.getString('startupError.databaseCannotBeOpened'),
Zotero.getString('startupError.checkPermissions')
]);
_startupError = msg;
}
Components.utils.reportError(e);
this.skipLoading = true;
Zotero.DB.skipBackup = true;

View file

@ -49,6 +49,8 @@ dataDir.selectedDirNonEmpty.title = Directory Not Empty
dataDir.selectedDirNonEmpty.text = The directory you selected is not empty and does not appear to be a Zotero data directory.\n\nCreate Zotero files in this directory anyway?
startupError = There was an error starting Zotero.
startupError.databaseCannotBeOpened = The Zotero database cannot be opened.
startupError.checkPermissions = Please make sure you have read and write permissions to all files in the Zotero data directory.
pane.collections.delete = Are you sure you want to delete the selected collection?
pane.collections.deleteSearch = Are you sure you want to delete the selected search?