Called by the Directory Service to obtain an nsIFile
object corresponding for a given standard path location.
The individual platform implementation of nsIDirectoryServiceProvider
maps the symbolic path location passed to this function and returns the appropriate nsIFile
.
nsIFile getFile( in string aName, out boolean aPersistent );
Parameters
-
aName
- [in] The symbolic name for a file or directory location. See Symbolic names below for a list of accepted values.
-
aPersistent
-
[out] This output parameter indicates to the caller whether or not the returned location is persistent. If
true
, this lets the Directory Service cache results to improve the performance of directory lookups. If false, then the Directory Service will not cache the results of this method.
Symbolic names
The list of symbolic names is subject to change, so be sure to take a look at the xpcom/io/nsDirectoryServiceDefs.h
file for the version of Gecko you're working with for the latest list.
Available on all platforms
These symbolic names are available on all platforms (although, of course, they may refer to different physical paths on the storage device).
C constant | String value | Notes |
---|---|---|
NS_OS_HOME_DIR |
"Home" | |
NS_OS_TEMP_DIR |
"TmpD" | |
NS_OS_CURRENT_WORKING_DIR |
"CurWorkD" | |
NS_OS_DESKTOP_DIR |
"Desk" | otherwise same as Home |
NS_OS_CURRENT_PROCESS_DIR |
"CurProcD" | |
NS_XPCOM_CURRENT_PROCESS_DIR |
"XCurProcD" | can be overriden by passing a "bin directory" to NS_InitXPCOM2(). |
NS_XPCOM_COMPONENT_DIR |
"ComsD" | |
NS_XPCOM_COMPONENT_DIR_LIST |
"ComsDL" | |
NS_XPCOM_COMPONENT_REGISTRY_FILE |
"ComRegF" | |
NS_XPCOM_XPTI_REGISTRY_FILE |
"XptiRegF" | |
NS_XPCOM_LIBRARY_FILE |
"XpcomLib" | |
NS_GRE_DIR |
"GreD" |
Note: On Mac OS X, up through Firefox 34 this is the |
NS_GRE_COMPONENT_DIR |
"GreComsD" |
Platform-specific locations
Some symbolic names represent platform-specific locations. The following sections cover these.
Available on both Mac and Unix
These locations are available on both Mac OS X and Unix implementations of Gecko.
C constant | String value | Notes |
---|---|---|
NS_OS_SYSTEM_DIR |
"SysD" |
Available on Mac OS X only
These locations are supported only on Mac OS X versions of Gecko.
C constant | String value | Notes |
---|---|---|
NS_MAC_DESKTOP_DIR |
NS_OS_DESKTOP_DIR |
|
NS_MAC_TRASH_DIR |
"Trsh" | |
NS_MAC_STARTUP_DIR |
"Strt" | |
NS_MAC_SHUTDOWN_DIR |
"Shdwn" | |
NS_MAC_APPLE_MENU_DIR |
"ApplMenu" | |
NS_MAC_CONTROL_PANELS_DIR |
"CntlPnl" | |
NS_MAC_EXTENSIONS_DIR |
"Exts" | |
NS_MAC_FONTS_DIR |
"Fnts" | |
NS_MAC_PREFS_DIR |
"Prfs" | |
NS_MAC_DOCUMENTS_DIR |
"Docs" | |
NS_MAC_INTERNET_SEARCH_DIR |
"ISrch" | |
NS_OSX_HOME_DIR |
NS_OS_HOME_DIR |
|
NS_MAC_HOME_DIR |
NS_OS_HOME_DIR |
|
NS_MAC_DEFAULT_DOWNLOAD_DIR |
"DfltDwnld" | |
NS_MAC_USER_LIB_DIR |
"ULibDir" | // Only available under OS X |
NS_OSX_DEFAULT_DOWNLOAD_DIR |
"DfltDwnld" | |
NS_OSX_USER_DESKTOP_DIR |
"UsrDsk" | |
NS_OSX_LOCAL_DESKTOP_DIR |
"LocDsk" | |
NS_OSX_USER_APPLICATIONS_DIR |
"UsrApp" | |
NS_OSX_LOCAL_APPLICATIONS_DIR |
"LocApp" | |
NS_OSX_USER_DOCUMENTS_DIR |
"UsrDocs" | |
NS_OSX_LOCAL_DOCUMENTS_DIR |
"LocDocs" | |
NS_OSX_USER_INTERNET_PLUGIN_DIR |
"UsrIntrntPlgn" | |
NS_OSX_LOCAL_INTERNET_PLUGIN_DIR |
"LoclIntrntPlgn" | |
NS_OSX_USER_FRAMEWORKS_DIR |
"UsrFrmwrks" | |
NS_OSX_LOCAL_FRAMEWORKS_DIR |
"LocFrmwrks" | |
NS_OSX_USER_PREFERENCES_DIR |
"UsrPrfs" | |
NS_OSX_LOCAL_PREFERENCES_DIR |
"LocPrfs" | |
NS_OSX_PICTURE_DOCUMENTS_DIR |
"Pct" | |
NS_OSX_MOVIE_DOCUMENTS_DIR |
"Mov" | |
NS_OSX_MUSIC_DOCUMENTS_DIR |
"Music" | |
NS_OSX_INTERNET_SITES_DIR |
"IntrntSts" |
Available on Windows only
These locations are supported only on Microsoft Windows builds of Gecko.
C constant | String value | Notes |
---|---|---|
NS_WIN_WINDOWS_DIR |
"WinD" | |
NS_WIN_PROGRAM_FILES_DIR |
"ProgF" | |
NS_WIN_HOME_DIR |
NS_OS_HOME_DIR |
|
NS_WIN_DESKTOP_DIR |
"DeskV" | virtual folder at the root of the namespace |
NS_WIN_PROGRAMS_DIR |
"Progs" | User start menu programs directory! |
NS_WIN_CONTROLS_DIR |
"Cntls" | |
NS_WIN_PRINTERS_DIR |
"Prnts" | |
NS_WIN_PERSONAL_DIR |
"Pers" | |
NS_WIN_FAVORITES_DIR |
"Favs" | |
NS_WIN_STARTUP_DIR |
"Strt" | |
NS_WIN_RECENT_DIR |
"Rcnt" | |
NS_WIN_SEND_TO_DIR |
"SndTo" | |
NS_WIN_BITBUCKET_DIR |
"Buckt" | |
NS_WIN_STARTMENU_DIR |
"Strt" | same thing as NS_OS_DESKTOP_DIR |
NS_WIN_DESKTOP_DIRECTORY |
"DeskP" | file sys dir which physically stores objects on desktop |
NS_WIN_DRIVES_DIR |
"Drivs" | |
NS_WIN_NETWORK_DIR |
"NetW" | |
NS_WIN_NETHOOD_DIR |
"netH" | |
NS_WIN_FONTS_DIR |
"Fnts" | |
NS_WIN_TEMPLATES_DIR |
"Tmpls" | |
NS_WIN_COMMON_STARTMENU_DIR |
"CmStrt" | |
NS_WIN_COMMON_PROGRAMS_DIR |
"CmPrgs" | |
NS_WIN_COMMON_STARTUP_DIR |
"CmStrt" | |
NS_WIN_COMMON_DESKTOP_DIRECTORY |
"CmDeskP" | |
NS_WIN_APPDATA_DIR |
"AppData" | |
NS_WIN_LOCAL_APPDATA_DIR |
"LocalAppData" | |
NS_WIN_PRINTHOOD |
"PrntHd" | |
NS_WIN_COOKIES_DIR |
"CookD" |
Available on Unix only
These locations are supported only on Unix builds of Firefox OS.
C constant | String value | Notes |
---|---|---|
NS_UNIX_LOCAL_DIR |
"Locl" | |
NS_UNIX_LIB_DIR |
"LibD" | |
NS_UNIX_HOME_DIR |
NS_OS_HOME_DIR |
The following locations are provided only on OS/2 builds of Gecko.
Deprecated
These locations have been deprecated and should no longer be used.
C constant | String value | Notes |
---|---|---|
NS_OS_DRIVE_DIR |
"DrvD" |