API published in: S60 2nd Ed
Link against: platformenv.lib
Required Capabilities
None
#include <pathinfo.h>
Platform Environment API provides interface for quering system paths. Methods provided by the API should be used instead of hard coded path names. All paths have the trailing backslash included. The API consist of the PathInfo class, DriveInfo class and system paths are defined in PathConfiguration.hrh. The DriveInfo class is defined in DriveInfo.h.
Usage:
#include <PathInfo.h> // Get the root path of Phone Memory. TFileName path = PathInfo::PhoneMemoryRootPath(); // Get the games path and append the path to the root path of Phone Memory. path.Append( PathInfo::GamesPath() ); // 'path' contains now the games path in Phone Memory.
Error handling:
The panic mechanism is used to handle programming errors. GetPath(TInt aPath) method will panic if invalid parameter is given as input. The panic category is named PATHINFO and panic code is:
Public Types |
|
enum | TSystemPaths { ENotSystemPath = -1, ERomRootPath = 0, EPhoneMemoryRootPath, EMemoryCardRootPath, EGamesPath, EInstallsPath, EOthersPath, EVideosPath, EImagesPath, EGsmPicturesPath, EMmsBackgroundImagesPath, EPresenceLogosPath, ESoundsPath, EDigitalSoundsPath, ESimpleSoundsPath, EImagesThumbnailPath, EMemoryCardContactsPath } |
Enumeration System Paths defines values to be used for the aPath parameter in GetPath and GetFullPath methods. More... |
|
Static Public Member Functions |
|
static IMPORT_C const TDesC & | RomRootPath () |
This method returns the root path in ROM. |
|
static IMPORT_C const TDesC & | PhoneMemoryRootPath () |
This method returns the root path in Phone Memory. |
|
static IMPORT_C const TDesC & | MemoryCardRootPath () |
This method returns the root path in Memory Card. |
|
static IMPORT_C const TDesC & | GamesPath () |
This method returns the games path to be appended to a root path. |
|
static IMPORT_C const TDesC & | InstallsPath () |
This method returns the installs path to be appended to a root path. |
|
static IMPORT_C const TDesC & | OthersPath () |
This method returns the others path to be appended to a root path. |
|
static IMPORT_C const TDesC & | VideosPath () |
This method returns the videos path to be appended to a root path. |
|
static IMPORT_C const TDesC & | ImagesPath () |
This method returns the images path to be appended to a root path. |
|
static IMPORT_C const TDesC & | PicturesPath () |
This method returns the pictures path to be appended to a root path. |
|
static IMPORT_C const TDesC & | GmsPicturesPath () |
This method returns the GMS pictures path to be appended to a root path. |
|
static IMPORT_C const TDesC & | MmsBackgroundImagesPath () |
This method returns the MMS background images path to be appended to a root path. |
|
static IMPORT_C const TDesC & | PresenceLogosPath () |
This method returns the presence logos path to be appended to a root path. |
|
static IMPORT_C const TDesC & | SoundsPath () |
This method returns the sounds path to be appended to a root path. |
|
static IMPORT_C const TDesC & | DigitalSoundsPath () |
This method returns the digital sounds path to be appended to a root path. |
|
static IMPORT_C const TDesC & | SimpleSoundsPath () |
This method returns the simple sounds path to be appended to a root path. |
|
static IMPORT_C const TDesC & | ImagesThumbnailPath () |
This method returns a thumbnail images path. |
|
static IMPORT_C const TDesC & | MemoryCardContactsPath () |
This method returns the full path of the contacts folder in the memory card. |
|
static IMPORT_C const TDesC & | GetPath (TInt aPath) |
This method returns the requested system path. |
|
static IMPORT_C TInt | GetRootPath (TDes &aRootPath, TInt aDrive) |
This method gets the root path of the requested drive. |
|
static IMPORT_C TInt | GetFullPath (TDes &aFullPath, TInt aDrive, TInt aPath) |
This method gets the full path of the requested system path in the requested drive. |
|
static IMPORT_C TInt | PathType (const TDesC &aFullPath) |
This method returns the system path type of the given path. |
|
static IMPORT_C CDesCArray * | GetListOfPathsLC (TInt aDrive) |
This method gets the list of full system paths in the requested drive and leaves the returned pointer in cleanup stack. |
|
static IMPORT_C CDesCArray * | GetListOfPathsL (TInt aDrive) |
This method gets the list of full system paths in the requested drive. |
|
Enumeration System Paths defines values to be used for the aPath parameter in GetPath and GetFullPath methods.
|
|
This method returns the digital sounds path to be appended to a root path. Corresponding TSystemPaths value of the returned path is EDigitalSoundsPath.
|
|
This method returns the games path to be appended to a root path. Corresponding TSystemPaths value of the returned path is EGamesPath.
|
|
This method gets the full path of the requested system path in the requested drive. KErrNotFound is returned when the drive has no requested system path or the requested path cannot be added to the root path.
#include <PathInfo.h> #include <DriveInfo.h> // Get the full path of the images folder in the default // phone memory drive. TFileName path; TInt drive; User::LeaveIfError( DriveInfo::GetDefaultDrive( DriveInfo::EDefaultPhoneMemory, drive ) ); User::LeaveIfError( PathInfo::GetFullPath( path, drive, PathInfo::EImages ) ); // 'path' contains now the full path of the images folder in the default // phone memory drive.
|
|
This method gets the list of full system paths in the requested drive.
|
|
This method gets the list of full system paths in the requested drive and leaves the returned pointer in cleanup stack.
#include <PathInfo.h> #include <DriveInfo.h> // Create the default path structure for default mass storage drive TInt drive; User::LeaveIfError( DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, drive ) ); CDesCArray* paths = PathInfo::GetListOfPathsLC( drive ); TInt count( paths->MdcaCount() ); for ( TInt i( 0 ); i < count; ++i ) { User::LeaveIfError( iFs.MkDirAll( paths->MdcaPoint( i ) ); } CleanupStack::PopAndDestroy( paths ); // The default mass storage drive contains now the default path structure
|
|
This method returns the requested system path.
#include <PathInfo.h> // Get the the full path of the contacts folder in the memory card. TFileName path = PathInfo::GetPath( PathInfo::EMemoryCardContactsPath ); // 'path' contains now the full path of the contacts folder in the memory card..
|
|
This method gets the root path of the requested drive. The root path is the path where the system paths are located.
#include <PathInfo.h> #include <DriveInfo.h> // Get the root path of the default phone memory. TInt drive; User::LeaveIfError( DriveInfo::GetDefaultDrive( DriveInfo::EDefaultPhoneMemory, drive ) ); TFileName path; User::LeaveIfError( PathInfo::GetRootPath( path, drive ) ); // 'path' contains now the default folder root path of the default phone memory.
|
|
This method returns the GMS pictures path to be appended to a root path. Corresponding TSystemPaths value of the returned path is EGsmPicturesPath.
|
|
This method returns the images path to be appended to a root path. Corresponding TSystemPaths value of the returned path is EImagesPath.
|
|
This method returns a thumbnail images path. The thumbnail images directory exists under the same directory where the corresponding image is. Do not try to append this to a root directory. Corresponding TSystemPaths value of the returned path is EImagesThumbnailPath.
|
|
This method returns the installs path to be appended to a root path. Corresponding TSystemPaths value of the returned path is EInstallsPath.
|
|
This method returns the full path of the contacts folder in the memory card. The path also contains the drive letter. Do not try to append this to any root directory. Corresponding TSystemPaths value of the returned path is EMemoryCardContactsPath.
|
|
This method returns the root path in Memory Card. Corresponding TSystemPaths value of the returned path is EMemoryCardRootPath.
|
|
This method returns the MMS background images path to be appended to a root path. Corresponding TSystemPaths value of the returned path is EMmsBackgroundImagesPath.
|
|
This method returns the others path to be appended to a root path. Corresponding TSystemPaths value of the returned path is EOthersPath.
|
|
This method returns the system path type of the given path. Thumbnail system path can exist in any folder. Other paths must be exact system paths, not subfolders of a system path ENotSystemPath is returned, if the path is not a system path. The given path must have backslash ending.
#include <PathInfo.h> // Check the type of the system path. _LIT( KImagesPath, "E:\\Images\\" ); TInt type( PathInfo::PathType( KImagesPath ) ); // 'type' contains now the EImagesPath value.
|
|
This method returns the root path in Phone Memory. Corresponding TSystemPaths value of the returned path is EPhoneMemoryRootPath.
|
|
This method returns the pictures path to be appended to a root path. Corresponding TSystemPaths value of the returned path is EGsmPicturesPath.
|
|
This method returns the presence logos path to be appended to a root path. Corresponding TSystemPaths value of the returned path is EPresenceLogosPath.
|
|
This method returns the root path in ROM. Corresponding TSystemPaths value of the returned path is ERomRootPath.
|
|
This method returns the simple sounds path to be appended to a root path. Corresponding TSystemPaths value of the returned path is ESimpleSoundsPath.
|
|
This method returns the sounds path to be appended to a root path. Corresponding TSystemPaths value of the returned path is ESoundsPath.
|
|
This method returns the videos path to be appended to a root path. Corresponding TSystemPaths value of the returned path is EVideosPath.
|