質問

I'm trying to get a list of currently open profiles. This code below lists alll profiles regardless of open:

var tps = Cc['@mozilla.org/toolkit/profile-service;1'].createInstance(Ci.nsIToolkitProfileService); //toolkitProfileService

var profileList = tps.profiles;
     while (profileList.hasMoreElements()) {
       var profile = profileList.getNext().QueryInterface(Ci.nsIToolkitProfile);
         console.info(profile)
     }
役に立ちましたか?

解決

Try to lock each profile. If already in use will throw NS_ERROR_FILE_ACCESS_DENIED

var inUse;
try{
  var profunlock = profile.lock(null);
  inUse = false;
  profunlock.unlock();
}
catch(e){
  inUse = true;
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top