2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
1999-12-22 04:56:45 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.1 (the "License"); you may not use this file except in
|
|
|
|
* compliance with the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/NPL/
|
1999-12-22 04:56:45 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1999-12-22 04:56:45 +03:00
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-12-22 04:56:45 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Contributor(s):
|
2000-06-28 01:23:51 +04:00
|
|
|
* IBM Corp.
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the NPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1999-12-22 04:56:45 +03:00
|
|
|
|
|
|
|
#ifndef nsDirectoryService_h___
|
|
|
|
#define nsDirectoryService_h___
|
|
|
|
|
2000-02-22 00:51:47 +03:00
|
|
|
#include "nsIDirectoryService.h"
|
1999-12-22 04:56:45 +03:00
|
|
|
#include "nsHashtable.h"
|
2000-08-17 02:40:27 +04:00
|
|
|
#include "nsILocalFile.h"
|
2000-02-22 00:51:47 +03:00
|
|
|
#include "nsISupportsArray.h"
|
2002-07-25 22:31:10 +04:00
|
|
|
#include "nsIAtom.h"
|
2000-08-17 02:40:27 +04:00
|
|
|
|
2002-09-27 17:07:01 +04:00
|
|
|
#define NS_XPCOM_INIT_CURRENT_PROCESS_DIR "MozBinD" // Can be used to set NS_XPCOM_CURRENT_PROCESS_DIR
|
|
|
|
// CANNOT be used to GET a location
|
|
|
|
|
2001-11-02 18:29:57 +03:00
|
|
|
class nsDirectoryService : public nsIDirectoryService,
|
|
|
|
public nsIProperties,
|
|
|
|
public nsIDirectoryServiceProvider2
|
2000-02-22 00:51:47 +03:00
|
|
|
{
|
|
|
|
public:
|
1999-12-22 04:56:45 +03:00
|
|
|
|
2000-02-22 00:51:47 +03:00
|
|
|
NS_DEFINE_STATIC_CID_ACCESSOR(NS_DIRECTORY_SERVICE_CID);
|
2000-04-25 05:48:02 +04:00
|
|
|
|
2000-02-22 00:51:47 +03:00
|
|
|
// nsISupports interface
|
|
|
|
NS_DECL_ISUPPORTS
|
1999-12-22 04:56:45 +03:00
|
|
|
|
2000-02-22 00:51:47 +03:00
|
|
|
NS_DECL_NSIPROPERTIES
|
1999-12-22 04:56:45 +03:00
|
|
|
|
2000-02-22 00:51:47 +03:00
|
|
|
NS_DECL_NSIDIRECTORYSERVICE
|
1999-12-22 04:56:45 +03:00
|
|
|
|
2000-02-22 00:51:47 +03:00
|
|
|
NS_DECL_NSIDIRECTORYSERVICEPROVIDER
|
2001-11-02 18:29:57 +03:00
|
|
|
|
|
|
|
NS_DECL_NSIDIRECTORYSERVICEPROVIDER2
|
1999-12-22 04:56:45 +03:00
|
|
|
|
2000-02-22 00:51:47 +03:00
|
|
|
nsDirectoryService();
|
1999-12-22 04:56:45 +03:00
|
|
|
virtual ~nsDirectoryService();
|
|
|
|
|
|
|
|
static NS_METHOD
|
|
|
|
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
|
|
|
|
2000-01-25 00:28:28 +03:00
|
|
|
private:
|
2000-08-17 02:40:27 +04:00
|
|
|
nsresult GetCurrentProcessDirectory(nsILocalFile** aFile);
|
|
|
|
|
2000-01-25 00:28:28 +03:00
|
|
|
static nsDirectoryService* mService;
|
2000-05-12 05:09:58 +04:00
|
|
|
static PRBool PR_CALLBACK ReleaseValues(nsHashKey* key, void* data, void* closure);
|
2003-04-04 00:02:03 +04:00
|
|
|
nsSupportsHashtable mHashtable;
|
2000-02-22 00:51:47 +03:00
|
|
|
nsCOMPtr<nsISupportsArray> mProviders;
|
2000-04-25 05:48:02 +04:00
|
|
|
|
2003-04-04 00:02:03 +04:00
|
|
|
public:
|
2000-04-25 05:48:02 +04:00
|
|
|
static nsIAtom *sCurrentProcess;
|
|
|
|
static nsIAtom *sComponentRegistry;
|
|
|
|
static nsIAtom *sComponentDirectory;
|
2003-03-12 00:36:59 +03:00
|
|
|
static nsIAtom *sXPTIRegistry;
|
2002-09-14 02:18:43 +04:00
|
|
|
static nsIAtom *sGRE_Directory;
|
|
|
|
static nsIAtom *sGRE_ComponentDirectory;
|
2000-04-25 05:48:02 +04:00
|
|
|
static nsIAtom *sOS_DriveDirectory;
|
|
|
|
static nsIAtom *sOS_TemporaryDirectory;
|
|
|
|
static nsIAtom *sOS_CurrentProcessDirectory;
|
|
|
|
static nsIAtom *sOS_CurrentWorkingDirectory;
|
2003-04-07 11:02:32 +04:00
|
|
|
#if defined (XP_MACOSX)
|
2000-04-25 05:48:02 +04:00
|
|
|
static nsIAtom *sDirectory;
|
|
|
|
static nsIAtom *sDesktopDirectory;
|
|
|
|
static nsIAtom *sTrashDirectory;
|
|
|
|
static nsIAtom *sStartupDirectory;
|
|
|
|
static nsIAtom *sShutdownDirectory;
|
|
|
|
static nsIAtom *sAppleMenuDirectory;
|
|
|
|
static nsIAtom *sControlPanelDirectory;
|
|
|
|
static nsIAtom *sExtensionDirectory;
|
|
|
|
static nsIAtom *sFontsDirectory;
|
|
|
|
static nsIAtom *sPreferencesDirectory;
|
|
|
|
static nsIAtom *sDocumentsDirectory;
|
|
|
|
static nsIAtom *sInternetSearchDirectory;
|
2001-06-14 05:24:22 +04:00
|
|
|
static nsIAtom *sUserLibDirectory;
|
2002-09-25 16:23:39 +04:00
|
|
|
static nsIAtom *sHomeDirectory;
|
|
|
|
static nsIAtom *sDefaultDownloadDirectory;
|
2003-04-07 11:02:32 +04:00
|
|
|
static nsIAtom *sUserDesktopDirectory;
|
|
|
|
static nsIAtom *sLocalDesktopDirectory;
|
|
|
|
static nsIAtom *sUserApplicationsDirectory;
|
|
|
|
static nsIAtom *sLocalApplicationsDirectory;
|
|
|
|
static nsIAtom *sUserDocumentsDirectory;
|
|
|
|
static nsIAtom *sLocalDocumentsDirectory;
|
|
|
|
static nsIAtom *sUserInternetPlugInDirectory;
|
|
|
|
static nsIAtom *sLocalInternetPlugInDirectory;
|
|
|
|
static nsIAtom *sUserFrameworksDirectory;
|
|
|
|
static nsIAtom *sLocalFrameworksDirectory;
|
|
|
|
static nsIAtom *sUserPreferencesDirectory;
|
|
|
|
static nsIAtom *sLocalPreferencesDirectory;
|
|
|
|
static nsIAtom *sPictureDocumentsDirectory;
|
|
|
|
static nsIAtom *sMovieDocumentsDirectory;
|
|
|
|
static nsIAtom *sMusicDocumentsDirectory;
|
|
|
|
static nsIAtom *sInternetSitesDirectory;
|
2000-11-29 02:27:38 +03:00
|
|
|
#elif defined (XP_WIN)
|
2000-04-25 05:48:02 +04:00
|
|
|
static nsIAtom *sSystemDirectory;
|
|
|
|
static nsIAtom *sWindowsDirectory;
|
|
|
|
static nsIAtom *sHomeDirectory;
|
|
|
|
static nsIAtom *sDesktop;
|
|
|
|
static nsIAtom *sPrograms;
|
|
|
|
static nsIAtom *sControls;
|
|
|
|
static nsIAtom *sPrinters;
|
|
|
|
static nsIAtom *sPersonal;
|
|
|
|
static nsIAtom *sFavorites;
|
|
|
|
static nsIAtom *sStartup;
|
|
|
|
static nsIAtom *sRecent;
|
|
|
|
static nsIAtom *sSendto;
|
|
|
|
static nsIAtom *sBitbucket;
|
|
|
|
static nsIAtom *sStartmenu;
|
|
|
|
static nsIAtom *sDesktopdirectory;
|
|
|
|
static nsIAtom *sDrives;
|
|
|
|
static nsIAtom *sNetwork;
|
|
|
|
static nsIAtom *sNethood;
|
|
|
|
static nsIAtom *sFonts;
|
|
|
|
static nsIAtom *sTemplates;
|
|
|
|
static nsIAtom *sCommon_Startmenu;
|
|
|
|
static nsIAtom *sCommon_Programs;
|
|
|
|
static nsIAtom *sCommon_Startup;
|
|
|
|
static nsIAtom *sCommon_Desktopdirectory;
|
|
|
|
static nsIAtom *sAppdata;
|
|
|
|
static nsIAtom *sPrinthood;
|
2003-01-10 05:52:26 +03:00
|
|
|
static nsIAtom *sWinCookiesDirectory;
|
2002-09-25 16:23:39 +04:00
|
|
|
#elif defined (XP_UNIX)
|
2000-04-25 05:48:02 +04:00
|
|
|
static nsIAtom *sLocalDirectory;
|
|
|
|
static nsIAtom *sLibDirectory;
|
|
|
|
static nsIAtom *sHomeDirectory;
|
2000-11-29 02:27:38 +03:00
|
|
|
#elif defined (XP_OS2)
|
|
|
|
static nsIAtom *sSystemDirectory;
|
|
|
|
static nsIAtom *sOS2Directory;
|
|
|
|
static nsIAtom *sHomeDirectory;
|
|
|
|
static nsIAtom *sDesktopDirectory;
|
2000-04-25 05:48:02 +04:00
|
|
|
#elif defined (XP_BEOS)
|
|
|
|
static nsIAtom *sSettingsDirectory;
|
|
|
|
static nsIAtom *sHomeDirectory;
|
|
|
|
static nsIAtom *sDesktopDirectory;
|
|
|
|
static nsIAtom *sSystemDirectory;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
1999-12-22 04:56:45 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2000-01-25 00:28:28 +03:00
|
|
|
#endif
|
|
|
|
|