Hi,
I currently moved my addon from a binary c++ xpcom to a extension created with the AddOn Sdk that uses ctypes, and managed to get a successful preliminary review.
I read that if the binary component isn’t packed in the xpi there is no need to upload the source code.
But now I would like to know what is the best way to “load” the dll inside the extension, my extension isn’t listed and is installed by unziping the xpi to a folder and creating a registry key.
If I move the DLL to the unzipeed folder as expected the signing will fail, but I really don’t want to use “full paths” in the scripts, since the software can be installed in machines with diferent languages so it can be inside “Program Files”, “Programas”, etc…
So my original code was something like this:
Cu.import("resource://gre/modules/Services.jsm"); const ResProtocolHandler = Services.io.getProtocolHandler("resource").QueryInterface(Ci.nsIResProtocolHandler); const ChromeRegistry = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIChromeRegistry); function resolveToFile(uri) { switch (uri.scheme) { case "chrome": return resolveToFile(ChromeRegistry.convertChromeURL(uri)); case "resource": return resolveToFile(Services.io.newURI(ResProtocolHandler.resolveURI(uri), null, null)); case "file": return uri.QueryInterface(Ci.nsIFileURL).file; default: throw new Error("cannot resolve"); } } const {data} = require("sdk/self"); let dll = data.url("ff40panel.dll"); dll = resolveToFile(Services.io.newURI(dll, null, null)); var ff40panellib = ctypes.open(dll.path);
So is there a way to know in the script for example enviroment folders (program data, program files), etc… so that I could use something like:
var ff40panellib = ctypes.open("{{ProgramFiles}}\\Marktest\\Netpanel\\Components\\ff-v40.x.x\\ff40panel.dll");
Thanks.
João Augusto