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
|
---|
4 | *
|
---|
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/
|
---|
9 | *
|
---|
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
|
---|
13 | * License.
|
---|
14 | *
|
---|
15 | * The Original Code is mozilla.org code.
|
---|
16 | *
|
---|
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.
|
---|
21 | *
|
---|
22 | * Contributor(s):
|
---|
23 | * IBM Corp.
|
---|
24 | *
|
---|
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.
|
---|
36 | *
|
---|
37 | * ***** END LICENSE BLOCK ***** */
|
---|
38 |
|
---|
39 | #ifndef nsDirectoryService_h___
|
---|
40 | #define nsDirectoryService_h___
|
---|
41 |
|
---|
42 | #include "nsIDirectoryService.h"
|
---|
43 | #include "nsHashtable.h"
|
---|
44 | #include "nsILocalFile.h"
|
---|
45 | #include "nsISupportsArray.h"
|
---|
46 | #include "nsIAtom.h"
|
---|
47 |
|
---|
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 |
|
---|
51 | class nsDirectoryService : public nsIDirectoryService,
|
---|
52 | public nsIProperties,
|
---|
53 | public nsIDirectoryServiceProvider2
|
---|
54 | {
|
---|
55 | public:
|
---|
56 |
|
---|
57 | NS_DEFINE_STATIC_CID_ACCESSOR(NS_DIRECTORY_SERVICE_CID);
|
---|
58 |
|
---|
59 | // nsISupports interface
|
---|
60 | NS_DECL_ISUPPORTS
|
---|
61 |
|
---|
62 | NS_DECL_NSIPROPERTIES
|
---|
63 |
|
---|
64 | NS_DECL_NSIDIRECTORYSERVICE
|
---|
65 |
|
---|
66 | NS_DECL_NSIDIRECTORYSERVICEPROVIDER
|
---|
67 |
|
---|
68 | NS_DECL_NSIDIRECTORYSERVICEPROVIDER2
|
---|
69 |
|
---|
70 | nsDirectoryService();
|
---|
71 |
|
---|
72 | static NS_METHOD
|
---|
73 | Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
---|
74 |
|
---|
75 | private:
|
---|
76 | ~nsDirectoryService();
|
---|
77 |
|
---|
78 | nsresult GetCurrentProcessDirectory(nsILocalFile** aFile);
|
---|
79 |
|
---|
80 | static nsDirectoryService* mService;
|
---|
81 | static PRBool PR_CALLBACK ReleaseValues(nsHashKey* key, void* data, void* closure);
|
---|
82 | nsSupportsHashtable mHashtable;
|
---|
83 | nsCOMPtr<nsISupportsArray> mProviders;
|
---|
84 |
|
---|
85 | public:
|
---|
86 | static nsIAtom *sCurrentProcess;
|
---|
87 | static nsIAtom *sComponentRegistry;
|
---|
88 | static nsIAtom *sComponentDirectory;
|
---|
89 | static nsIAtom *sXPTIRegistry;
|
---|
90 | static nsIAtom *sGRE_Directory;
|
---|
91 | static nsIAtom *sGRE_ComponentDirectory;
|
---|
92 | static nsIAtom *sOS_DriveDirectory;
|
---|
93 | static nsIAtom *sOS_TemporaryDirectory;
|
---|
94 | static nsIAtom *sOS_CurrentProcessDirectory;
|
---|
95 | static nsIAtom *sOS_CurrentWorkingDirectory;
|
---|
96 | #if defined (XP_MACOSX)
|
---|
97 | static nsIAtom *sDirectory;
|
---|
98 | static nsIAtom *sDesktopDirectory;
|
---|
99 | static nsIAtom *sTrashDirectory;
|
---|
100 | static nsIAtom *sStartupDirectory;
|
---|
101 | static nsIAtom *sShutdownDirectory;
|
---|
102 | static nsIAtom *sAppleMenuDirectory;
|
---|
103 | static nsIAtom *sControlPanelDirectory;
|
---|
104 | static nsIAtom *sExtensionDirectory;
|
---|
105 | static nsIAtom *sFontsDirectory;
|
---|
106 | static nsIAtom *sPreferencesDirectory;
|
---|
107 | static nsIAtom *sDocumentsDirectory;
|
---|
108 | static nsIAtom *sInternetSearchDirectory;
|
---|
109 | static nsIAtom *sUserLibDirectory;
|
---|
110 | static nsIAtom *sHomeDirectory;
|
---|
111 | static nsIAtom *sDefaultDownloadDirectory;
|
---|
112 | static nsIAtom *sUserDesktopDirectory;
|
---|
113 | static nsIAtom *sLocalDesktopDirectory;
|
---|
114 | static nsIAtom *sUserApplicationsDirectory;
|
---|
115 | static nsIAtom *sLocalApplicationsDirectory;
|
---|
116 | static nsIAtom *sUserDocumentsDirectory;
|
---|
117 | static nsIAtom *sLocalDocumentsDirectory;
|
---|
118 | static nsIAtom *sUserInternetPlugInDirectory;
|
---|
119 | static nsIAtom *sLocalInternetPlugInDirectory;
|
---|
120 | static nsIAtom *sUserFrameworksDirectory;
|
---|
121 | static nsIAtom *sLocalFrameworksDirectory;
|
---|
122 | static nsIAtom *sUserPreferencesDirectory;
|
---|
123 | static nsIAtom *sLocalPreferencesDirectory;
|
---|
124 | static nsIAtom *sPictureDocumentsDirectory;
|
---|
125 | static nsIAtom *sMovieDocumentsDirectory;
|
---|
126 | static nsIAtom *sMusicDocumentsDirectory;
|
---|
127 | static nsIAtom *sInternetSitesDirectory;
|
---|
128 | #elif defined (XP_WIN)
|
---|
129 | static nsIAtom *sSystemDirectory;
|
---|
130 | static nsIAtom *sWindowsDirectory;
|
---|
131 | static nsIAtom *sHomeDirectory;
|
---|
132 | static nsIAtom *sDesktop;
|
---|
133 | static nsIAtom *sPrograms;
|
---|
134 | static nsIAtom *sControls;
|
---|
135 | static nsIAtom *sPrinters;
|
---|
136 | static nsIAtom *sPersonal;
|
---|
137 | static nsIAtom *sFavorites;
|
---|
138 | static nsIAtom *sStartup;
|
---|
139 | static nsIAtom *sRecent;
|
---|
140 | static nsIAtom *sSendto;
|
---|
141 | static nsIAtom *sBitbucket;
|
---|
142 | static nsIAtom *sStartmenu;
|
---|
143 | static nsIAtom *sDesktopdirectory;
|
---|
144 | static nsIAtom *sDrives;
|
---|
145 | static nsIAtom *sNetwork;
|
---|
146 | static nsIAtom *sNethood;
|
---|
147 | static nsIAtom *sFonts;
|
---|
148 | static nsIAtom *sTemplates;
|
---|
149 | static nsIAtom *sCommon_Startmenu;
|
---|
150 | static nsIAtom *sCommon_Programs;
|
---|
151 | static nsIAtom *sCommon_Startup;
|
---|
152 | static nsIAtom *sCommon_Desktopdirectory;
|
---|
153 | static nsIAtom *sAppdata;
|
---|
154 | static nsIAtom *sPrinthood;
|
---|
155 | static nsIAtom *sWinCookiesDirectory;
|
---|
156 | #elif defined (XP_UNIX)
|
---|
157 | static nsIAtom *sLocalDirectory;
|
---|
158 | static nsIAtom *sLibDirectory;
|
---|
159 | static nsIAtom *sHomeDirectory;
|
---|
160 | #elif defined (XP_OS2)
|
---|
161 | static nsIAtom *sSystemDirectory;
|
---|
162 | static nsIAtom *sOS2Directory;
|
---|
163 | static nsIAtom *sHomeDirectory;
|
---|
164 | static nsIAtom *sDesktopDirectory;
|
---|
165 | #elif defined (XP_BEOS)
|
---|
166 | static nsIAtom *sSettingsDirectory;
|
---|
167 | static nsIAtom *sHomeDirectory;
|
---|
168 | static nsIAtom *sDesktopDirectory;
|
---|
169 | static nsIAtom *sSystemDirectory;
|
---|
170 | #endif
|
---|
171 |
|
---|
172 |
|
---|
173 | };
|
---|
174 |
|
---|
175 |
|
---|
176 | #endif
|
---|
177 |
|
---|