Skip to content

Commit

Permalink
auto detect of ppost.jar now works the way it should
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasbits committed Feb 20, 2014
1 parent 7f35612 commit 30ea9b2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
12 changes: 9 additions & 3 deletions chrome/content/pennyPostOptions.js
Expand Up @@ -86,13 +86,19 @@ function onTestRegEx(){
* Tries to populate the path of ppost.jar automatically
*/
function onDetectStampProgram(){
var jarpath=getJarPath();
if(jarpath==''){
getJarPath(function(data){
var jarpath=data;
dialog.ppost.value=jarpath;
prefs.setCharPref('extensions.ppost.path', dialog.ppost.value);
});

//var jarpath=getJarPath();
/*if(jarpath==''){
alert(gStrBundle.getString("jarpathdetectfail"));
}else{
dialog.ppost.value=jarpath;
prefs.setCharPref('extensions.ppost.path', dialog.ppost.value);
}
}*/
}

/**
Expand Down
8 changes: 4 additions & 4 deletions chrome/content/ppost.js
Expand Up @@ -35,7 +35,7 @@ var gStampTypes={ UNKNOWN:0,
* Tries to get the path of ppost.jar relative to the extension folder
* This jar is in the lib folder of the extension folder
*/
function getJarPath(){
function getJarPath(callback){
try{
var eid = "{3748ced8-ae28-48ac-a954-4bff3360f72d}";
/**var ext = Components.classes["@mozilla.org/extensions/manager;1"]
Expand All @@ -49,7 +49,7 @@ function getJarPath(){
Components.utils.import("resource://gre/modules/AddonManager.jsm");
AddonManager.getAddonByID(eid, function(addon) {
addonLocation = addon.getResourceURI("/lib/ppost.jar").QueryInterface(Components.interfaces.nsIFileURL).file.path;
alert("Copy this " + addonLocation);
callback(addonLocation);
}); //end of AddonManager async call
/*if(!ext.exists()){
throw new Error('ppost.jar not found in '+ext.path);
Expand All @@ -59,9 +59,9 @@ function getJarPath(){
}catch(ex){
Components.utils.reportError(ex);
//ignore
return '';
//return '';
}
return "Copy path from popup dialog";
//return "Copy path from popup dialog";
}

/**
Expand Down

0 comments on commit 30ea9b2

Please sign in to comment.