1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
25 * Alternatively, the contents of this file may be used under the terms of
26 * either of the GNU General Public License Version 2 or later (the "GPL"),
27 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
39 #ifndef nsDirectoryService_h___
40 #define nsDirectoryService_h___
42 #include "nsIDirectoryService.h"
43 #include "nsHashtable.h"
44 #include "nsILocalFile.h"
45 #include "nsISupportsArray.h"
48 #define NS_XPCOM_INIT_CURRENT_PROCESS_DIR "MozBinD" // Can be used to set NS_XPCOM_CURRENT_PROCESS_DIR
49 // CANNOT be used to GET a location
50 #define NS_DIRECTORY_SERVICE_CID {0xf00152d0,0xb40b,0x11d3,{0x8c, 0x9c, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74}}
52 class nsDirectoryService
: public nsIDirectoryService
,
54 public nsIDirectoryServiceProvider2
58 // nsISupports interface
63 NS_DECL_NSIDIRECTORYSERVICE
65 NS_DECL_NSIDIRECTORYSERVICEPROVIDER
67 NS_DECL_NSIDIRECTORYSERVICEPROVIDER2
70 ~nsDirectoryService();
72 static nsresult
RealInit();
73 void RegisterCategoryProviders();
76 Create(nsISupports
*aOuter
, REFNSIID aIID
, void **aResult
);
78 static nsDirectoryService
* gService
;
81 nsresult
GetCurrentProcessDirectory(nsILocalFile
** aFile
);
83 static PRBool PR_CALLBACK
ReleaseValues(nsHashKey
* key
, void* data
, void* closure
);
84 nsSupportsHashtable mHashtable
;
85 nsCOMPtr
<nsISupportsArray
> mProviders
;
88 static nsIAtom
*sCurrentProcess
;
89 static nsIAtom
*sComponentRegistry
;
90 static nsIAtom
*sComponentDirectory
;
91 static nsIAtom
*sXPTIRegistry
;
92 static nsIAtom
*sGRE_Directory
;
93 static nsIAtom
*sGRE_ComponentDirectory
;
94 static nsIAtom
*sOS_DriveDirectory
;
95 static nsIAtom
*sOS_TemporaryDirectory
;
96 static nsIAtom
*sOS_CurrentProcessDirectory
;
97 static nsIAtom
*sOS_CurrentWorkingDirectory
;
98 static nsIAtom
*sOS_DesktopDirectory
;
99 static nsIAtom
*sOS_HomeDirectory
;
100 #if defined (XP_MACOSX)
101 static nsIAtom
*sDirectory
;
102 static nsIAtom
*sTrashDirectory
;
103 static nsIAtom
*sStartupDirectory
;
104 static nsIAtom
*sShutdownDirectory
;
105 static nsIAtom
*sAppleMenuDirectory
;
106 static nsIAtom
*sControlPanelDirectory
;
107 static nsIAtom
*sExtensionDirectory
;
108 static nsIAtom
*sFontsDirectory
;
109 static nsIAtom
*sPreferencesDirectory
;
110 static nsIAtom
*sDocumentsDirectory
;
111 static nsIAtom
*sInternetSearchDirectory
;
112 static nsIAtom
*sUserLibDirectory
;
113 static nsIAtom
*sDefaultDownloadDirectory
;
114 static nsIAtom
*sUserDesktopDirectory
;
115 static nsIAtom
*sLocalDesktopDirectory
;
116 static nsIAtom
*sUserApplicationsDirectory
;
117 static nsIAtom
*sLocalApplicationsDirectory
;
118 static nsIAtom
*sUserDocumentsDirectory
;
119 static nsIAtom
*sLocalDocumentsDirectory
;
120 static nsIAtom
*sUserInternetPlugInDirectory
;
121 static nsIAtom
*sLocalInternetPlugInDirectory
;
122 static nsIAtom
*sUserFrameworksDirectory
;
123 static nsIAtom
*sLocalFrameworksDirectory
;
124 static nsIAtom
*sUserPreferencesDirectory
;
125 static nsIAtom
*sLocalPreferencesDirectory
;
126 static nsIAtom
*sPictureDocumentsDirectory
;
127 static nsIAtom
*sMovieDocumentsDirectory
;
128 static nsIAtom
*sMusicDocumentsDirectory
;
129 static nsIAtom
*sInternetSitesDirectory
;
130 #elif defined (XP_WIN)
131 static nsIAtom
*sSystemDirectory
;
132 static nsIAtom
*sWindowsDirectory
;
133 static nsIAtom
*sWindowsProgramFiles
;
134 static nsIAtom
*sDesktop
;
135 static nsIAtom
*sPrograms
;
136 static nsIAtom
*sControls
;
137 static nsIAtom
*sPrinters
;
138 static nsIAtom
*sPersonal
;
139 static nsIAtom
*sFavorites
;
140 static nsIAtom
*sStartup
;
141 static nsIAtom
*sRecent
;
142 static nsIAtom
*sSendto
;
143 static nsIAtom
*sBitbucket
;
144 static nsIAtom
*sStartmenu
;
145 static nsIAtom
*sDesktopdirectory
;
146 static nsIAtom
*sDrives
;
147 static nsIAtom
*sNetwork
;
148 static nsIAtom
*sNethood
;
149 static nsIAtom
*sFonts
;
150 static nsIAtom
*sTemplates
;
151 static nsIAtom
*sCommon_Startmenu
;
152 static nsIAtom
*sCommon_Programs
;
153 static nsIAtom
*sCommon_Startup
;
154 static nsIAtom
*sCommon_Desktopdirectory
;
155 static nsIAtom
*sAppdata
;
156 static nsIAtom
*sLocalAppdata
;
157 static nsIAtom
*sPrinthood
;
158 static nsIAtom
*sWinCookiesDirectory
;
159 static nsIAtom
*sDefaultDownloadDirectory
;
160 #elif defined (XP_UNIX)
161 static nsIAtom
*sLocalDirectory
;
162 static nsIAtom
*sLibDirectory
;
163 static nsIAtom
*sXDGDesktop
;
164 static nsIAtom
*sXDGDocuments
;
165 static nsIAtom
*sXDGDownload
;
166 static nsIAtom
*sXDGMusic
;
167 static nsIAtom
*sXDGPictures
;
168 static nsIAtom
*sXDGPublicShare
;
169 static nsIAtom
*sXDGTemplates
;
170 static nsIAtom
*sXDGVideos
;
171 static nsIAtom
*sDefaultDownloadDirectory
;
172 #elif defined (XP_OS2)
173 static nsIAtom
*sSystemDirectory
;
174 static nsIAtom
*sOS2Directory
;
175 #elif defined (XP_BEOS)
176 static nsIAtom
*sSettingsDirectory
;
177 static nsIAtom
*sSystemDirectory
;