Skip to content

TagSpaces is an offline, open source, document manager with tagging support

Added functionality for openning the folder where tagspaces locations are located

uggrocke2d23608dcc6
diff --git a/data/js/ioapi.mozilla.js b/data/js/ioapi.mozilla.js
index 2e6c039ee..9e03a303e 100644
--- a/data/js/ioapi.mozilla.js
+++ b/data/js/ioapi.mozilla.js
@@ -137,3 +137,12 @@ IOAPI.openDirectory = function(dirPath) {
}});
document.documentElement.dispatchEvent(event);
}
+
+IOAPI.openExtensionsDirectory = function() {
+ console.debug("Opening extensions directory...");
+ var event = document.createEvent('CustomEvent');
+ event.initCustomEvent("addon-message", true, true, {"detail":{
+ "command": "openExtensionsDirectory"
+ }});
+ document.documentElement.dispatchEvent(event);
+}
\ No newline at end of file
diff --git a/data/js/settings.ui.js b/data/js/settings.ui.js
index 43941971a..846e088ed 100644
--- a/data/js/settings.ui.js
+++ b/data/js/settings.ui.js
@@ -73,6 +73,9 @@ SettingsUI.initDialogs = function() {
width: 600,
modal: true,
buttons: {
+ "Ext. Folder": function() {
+ IOAPI.openExtensionsDirectory()
+ },
"Settings Editor": function() {
if($("#settingsEditor").is(":hidden") ) {
$("#settingsPlainJSON").hide();
diff --git a/lib/ioutils.js b/lib/ioutils.js
index b1549ef12..dfeaca67c 100644
--- a/lib/ioutils.js
+++ b/lib/ioutils.js
@@ -356,4 +356,24 @@ exports.openDirectory = function openDirectory(dirPath, worker) {
} catch(ex) {
console.error("Opening directory failed "+ex);
}
+}
+
+/**
+ * Open the directory where the user can install tagspaces extensions
+ * This directory is located in the profile with which firefox is started
+ */
+exports.openExtensionsDirectory = function openExtensionsDirectory(worker) {
+ console.debug("Opening extensions directory...");
+ try {
+ // Other nsIPropertues such as ProfD could be found on
+ // https://developer.mozilla.org/de/docs/Code_snippets/File_I_O
+ var file = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties).get("ProfD", Ci.nsIFile);
+ var profileDir = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
+ profileDir.initWithPath(file.path+"/extensions/jid1-FBaMKxTifTSahQ@jetpack/resources/tagspaces/data/ext");
+ if (profileDir.isDirectory()) {
+ profileDir.QueryInterface(Ci.nsILocalFile).launch();
+ }
+ } catch(ex) {
+ console.error("Opening extensions directory failed "+ex);
+ }
}
\ No newline at end of file
diff --git a/lib/main.js b/lib/main.js
index ff1cf8ada..423d3178d 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -130,6 +130,9 @@ function handleMessage(msg, worker) {
case "openDirectory":
ioutils.openDirectory(msg.detail.path,worker);
break;
+ case "openExtensionsDirectory":
+ ioutils.openExtensionsDirectory(worker);
+ break;
default:
break;
}