From a50e9fa2bd29b840e226ee92eedf3689f134270a Mon Sep 17 00:00:00 2001 From: Eric Butler Date: Sat, 29 Jan 2011 23:20:09 -0800 Subject: [PATCH] Added Filevault workaround. Closes #9. --- xpi/modules/Firesheep.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/xpi/modules/Firesheep.js b/xpi/modules/Firesheep.js index 600583c..5e7927c 100644 --- a/xpi/modules/Firesheep.js +++ b/xpi/modules/Firesheep.js @@ -212,7 +212,22 @@ var Firesheep = { } else { file.append("firesheep-backend"); } - + + // Hack for filevault + var osString = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).OS; + if (osString == 'Darwin') { + var username = Utils.runCommand('whoami', []).trim(); + var vaultFile = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile); + vaultFile.initWithPath("/Users/." + username + "/" + username + ".sparsebundle"); + if (vaultFile.exists()) { + var tmpFile = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile); + tmpFile.initWithPath("/tmp/firesheep-backend"); + if (!tmpFile.exists()) + file.copyTo(tmpFile.parent, tmpFile.leafName); + return tmpFile.path; + } + } + return file.path; },