Lev Serebryakov wrote:
> 
>   My extension need to know name (only name!) of current profile. It should 
> work in Mozilla (1.7.x) and fireFox.
> 
>   I've wrote this code:
> 
> ==============================================================
>   _init: function()
>   {
>    ......
>     this._profileManager = null;
>     this._profileMethod  = '';
>     if     ( "@mozilla.org/profile/manager;1" in Components.classes )
>     {
>       try
>       {
>         this._profileManager = Components.classes[ 
> "@mozilla.org/profile/manager;1" 
> ].getService(Components.interfaces.nsIProfile);
>         this._profileMethod  = 'old';
>       }
>       catch( ex )
>       {
>         dump( "[MyExt] Can not get old profile manager\n" );
>       }
>     }
>     else if( "@mozilla.org/toolkit/profile-service;1" in Components.classes )
>     {
>       try
>       {
>         this._profileManager = Components.classes[ 
> "@mozilla.org/toolkit/profile-service;1" 
> ].getService(Components.interfaces.nsIToolkitProfileService);
>         this._profileMethod  = 'new';
>       }
>       catch( ex )
>       {
>         dump( "[MyExt] Can not get new profile manager\n" );
>       }
>     }
>     else
>     {
>       dump( "[MyExt] No old nor new profile manager found :(\n" );
>     }
>    ......
>   },
>    ......
>   _getProfileName: function()
>   {
>     switch( this._profileMethod )
>     {
>     case 'old':
>       return this._profileManager.currentProfile;
>     case 'new':
>       return this._profileManager.selectedProfile.name;
>     default:
>       break;
>     }
>     return '';
>   },
>   ...
> ==============================================================
> 
>   And I ALWAYS get "No old nor new profile manager found :(" under FireFox! 
> How could I know current profile name in browser?
> 
> Lev Serebryakov
> Programmer
> JetBrains, Inc
> http://www.jetbrains.com
> "Develop with pleasure!"
> 
> 
if you start thunderbird or firefox with a parameter "-p", it will
display the name of the profile. But  I don't know how to display the
path to the profile.

-- 
  .~.    Might, Courage, Vision. http://www.linux-sxs.org
 / v \
/( _ )\  Linux 2.4.29
  ^ ^    10:55pm up 2 days 11:58 load average: 0.32 0.58 0.71
_______________________________________________
Mozilla-xpcom mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to