2 Replies Latest reply on May 31, 2011 7:51 AM by ishnigma

    transition from my firefox extension to a Flash Builder desktop app

    ishnigma

      Trying to make a slow transistion from my firefox extension to a Flash Builder desktop app.

       

      Okay i'm not familiar on how to go about this I have js code that lets my app sync it self with the lates build it looks for a new version number which is in a txt file. Inside the txt file I have 0.0.0 so evertime I change the version number to 0.0.1. The app checks for new updates and sees the txt file has a new version number and start to pull in the zip file and extrudes the zip into the directory.

       

      I can't get my head around on how to modify this code ["@mozilla.org/extensions/manager;1"].getService
      to look in the root directory of my Flash Builder app.

       

       

       

      function Xcalibur_Sync(){
          document.documentElement.getButton("accept").disabled = true;
          var Cc = Components.classes;
          var Ci = Components.interfaces;
          var url = xcaliburGetUnicharPref("extensions.xcalibur.downloadurl");
          var Step1 = document.getElementById("xcalStep1");
          var Step1done = document.getElementById("xcalStep1Done");
          var Step2 = document.getElementById("xcalStep2");
          var Step2done = document.getElementById("xcalStep2Done");
          var Step3 = document.getElementById("xcalStep3");
          var Step3done = document.getElementById("xcalStep3Done");
          var Step4 = document.getElementById("xcalStep4");
          var Step4done = document.getElementById("xcalStep4Done");
          var xcalSyncDone = document.getElementById("xcalSyncDone");

       

          var progressMeter = document.getElementById("xcalProgressMeter");
          var progressPct = document.getElementById("xcalProgressPct");
         
        // Get Xcalibur version and location
          var GUID = "xcalibur@ish.com"
          var gExtensionManager = Cc["@mozilla.org/extensions/manager;1"].getService(Ci.nsIExtensionManager);
        //var currentVersion = gExtensionManager.getItemForID(GUID).version;
          var currentVersion = xcaliburPrefs.getCharPref("extensions.xcalibur.installedversion");
          var xcaliburdir = gExtensionManager.getInstallLocation(GUID).getItemLocation(GUID);
          var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
          file.initWithPath(xcaliburdir.path);
         
          //Step 1 - See if an update is available
          Step1.setAttribute("hidden", "false");
          var req = new XMLHttpRequest();
          req.open('GET', url+"CRV.txt", false);
          try{
              req.send(null);
          }catch(e){
              alert("Cannot get update information from "+url+"CRV.txt\n"+e.toString()+"\n\nSync aborted ...");
              window.close();
              return false;
          }//try
          if(req.status == 200){
              var CRV = req.responseText;

       

       

       

      Any Ideas?

      Thanks,

      Ish