PathInfo Class Reference

#include <pathinfo.h>

Link against: PlatformEnv.dll

class PathInfo
Public Member Enumerations
enumTSystemPaths { ENotSystemPath, ERomRootPath, EPhoneMemoryRootPath, EMemoryCardRootPath, ..., EMemoryCardContactsPath }
Public Member Functions
IMPORT_C const TDesC &DigitalSoundsPath()
IMPORT_C const TDesC &GamesPath()
IMPORT_C TIntGetFullPath(TDes &, TInt, TInt)
IMPORT_C CDesCArray *GetListOfPathsL(TInt)
IMPORT_C CDesCArray *GetListOfPathsLC(TInt)
IMPORT_C const TDesC &GetPath(TInt)
IMPORT_C TIntGetRootPath(TDes &, TInt)
IMPORT_C const TDesC &GmsPicturesPath()
IMPORT_C const TDesC &ImagesPath()
IMPORT_C const TDesC &ImagesThumbnailPath()
IMPORT_C const TDesC &InstallsPath()
IMPORT_C const TDesC &MemoryCardContactsPath()
IMPORT_C const TDesC &MemoryCardRootPath()
IMPORT_C const TDesC &MmsBackgroundImagesPath()
IMPORT_C const TDesC &OthersPath()
IMPORT_C TIntPathType(const TDesC &)
IMPORT_C const TDesC &PhoneMemoryRootPath()
IMPORT_C const TDesC &PicturesPath()
IMPORT_C const TDesC &PresenceLogosPath()
IMPORT_C const TDesC &RomRootPath()
IMPORT_C const TDesC &SimpleSoundsPath()
IMPORT_C const TDesC &SoundsPath()
IMPORT_C const TDesC &VideosPath()

Detailed Description

Class holds information of system paths. 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:

  • EInvalidParameter = 0 (Invalid parameter.)

Since
2.0

Member Enumeration Documentation

Enum TSystemPaths

Enumeration System Paths defines values to be used for the aPath parameter in GetPath and GetFullPath methods.
Since
3.2
EnumeratorValueDescription
ENotSystemPath-1

This value is used only as a return value of PathType() to indicate that the path is not a system path. It is not a valid system path to be given as a parameter for GetPath() or GetFullPath()

ERomRootPath0

To get the root path in ROM.

EPhoneMemoryRootPath

To get the root path in Phone Memory..

EMemoryCardRootPath

To get the root path in Memory Card.

EGamesPath

To get the games path to be appended to a root path.

EInstallsPath

To get the installs path to be appended to a root path.

EOthersPath

To get the others path to be appended to a root path.

EVideosPath

To get the videos path to be appended to a root path.

EImagesPath

To get the images path to be appended to a root path.

EGsmPicturesPath

To get the GSM pictures path to be appended to a root path.

EMmsBackgroundImagesPath

To get the MMS pictures path to be appended to a root path.

EPresenceLogosPath

To get the presence logos path to be appended to a root path.

ESoundsPath

To get the sounds path to be appended to a root path.

EDigitalSoundsPath

To get the digital sounds path to be appended to a root path.

ESimpleSoundsPath

To get the simple sounds path to be appended to a root path.

EImagesThumbnailPath

To get the images thumbnail 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.

EMemoryCardContactsPath

To get 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.

Member Function Documentation

DigitalSoundsPath ( )

IMPORT_C const TDesC &DigitalSoundsPath()[static]

This method returns the digital sounds path to be appended to a root path. Corresponding TSystemPaths value of the returned path is EDigitalSoundsPath.

See also: TSystemPaths

Returns: The digital sounds path.

GamesPath ( )

IMPORT_C const TDesC &GamesPath()[static]

This method returns the games path to be appended to a root path. Corresponding TSystemPaths value of the returned path is EGamesPath.

See also: TSystemPaths

Returns: The games path.

GetFullPath ( TDes &, TInt, TInt )

IMPORT_C TIntGetFullPath(TDes &aFullPath,
TIntaDrive,
TIntaPath
)[static]

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.

Since
3.2
One small sample describing the usage of the method.
  #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.

See also: TDriveNumber KMaxPath TSystemPaths DriveInfo

ParameterDescription
aFullPathStores the requested path, the maximum path length is KMaxPath.
aDriveA drive identifier specified by TDriveNumber.
aPathDefines the requested system path.

Returns: A system wide error codes.

GetListOfPathsL ( TInt )

IMPORT_C CDesCArray *GetListOfPathsL(TIntaDrive)[static]

This method gets the list of full system paths in the requested drive.

Since
3.2

See also: TDriveNumber

ParameterDescription
aDriveA drive identifier specified by TDriveNumber.

Returns: A list of the system paths. Ownership is transferred.

GetListOfPathsLC ( TInt )

IMPORT_C CDesCArray *GetListOfPathsLC(TIntaDrive)[static]

This method gets the list of full system paths in the requested drive and leaves the returned pointer in cleanup stack.

Since
3.2
One small sample describing the usage of the method.
  #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

See also: TDriveNumber DriveInfo

ParameterDescription
aDriveA drive identifier specified by TDriveNumber.

Returns: A list of the system paths. Ownership is transferred.

GetPath ( TInt )

IMPORT_C const TDesC &GetPath(TIntaPath)[static]

This method returns the requested system path.

Since
3.2
panic
EInvalidParameter Parameter aPath is invalid.
One small sample describing the usage of the method.
  #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..

See also: TSystemPaths

ParameterDescription
aPathDefines the requested system path.

Returns: The requested system path.

GetRootPath ( TDes &, TInt )

IMPORT_C TIntGetRootPath(TDes &aRootPath,
TIntaDrive
)[static]

This method gets the root path of the requested drive. The root path is the path where the system paths are located.

Since
3.2
One small sample describing the usage of the method.
  #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.

See also: TDriveNumber KMaxPath DriveInfo

ParameterDescription
aRootPathStores the path, the maximum path length is KMaxPath.
aDriveA drive identifier specified by TDriveNumber.

Returns: A system wide error code.

GmsPicturesPath ( )

IMPORT_C const TDesC &GmsPicturesPath()[static]

This method returns the GMS pictures path to be appended to a root path. Corresponding TSystemPaths value of the returned path is EGsmPicturesPath.

See also: TSystemPaths

Returns: The GSM pictures path.

ImagesPath ( )

IMPORT_C const TDesC &ImagesPath()[static]

This method returns the images path to be appended to a root path. Corresponding TSystemPaths value of the returned path is EImagesPath.

See also: TSystemPaths

Returns: The images path.

ImagesThumbnailPath ( )

IMPORT_C const TDesC &ImagesThumbnailPath()[static]

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.

See also: TSystemPaths

Returns: The thumbnail images path.

InstallsPath ( )

IMPORT_C const TDesC &InstallsPath()[static]

This method returns the installs path to be appended to a root path. Corresponding TSystemPaths value of the returned path is EInstallsPath.

See also: TSystemPaths

Returns: The installs path.

MemoryCardContactsPath ( )

IMPORT_C const TDesC &MemoryCardContactsPath()[static]

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.

See also: TSystemPaths

Returns: The full path of the contacts folder in the memory card.

MemoryCardRootPath ( )

IMPORT_C const TDesC &MemoryCardRootPath()[static]

This method returns the root path in Memory Card. Corresponding TSystemPaths value of the returned path is EMemoryCardRootPath.

See also: TSystemPaths

Returns: The root path in Memory Card.

MmsBackgroundImagesPath ( )

IMPORT_C const TDesC &MmsBackgroundImagesPath()[static]

This method returns the MMS background images path to be appended to a root path. Corresponding TSystemPaths value of the returned path is EMmsBackgroundImagesPath.

See also: TSystemPaths

Returns: The MMS background images path.

OthersPath ( )

IMPORT_C const TDesC &OthersPath()[static]

This method returns the others path to be appended to a root path. Corresponding TSystemPaths value of the returned path is EOthersPath.

See also: TSystemPaths

Returns: The installs path.

PathType ( const TDesC & )

IMPORT_C TIntPathType(const TDesC &aFullPath)[static]

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.

Since
3.2
One small sample describing the usage of the method.
  #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.

See also: TSystemPaths

ParameterDescription
aFullPathA path to be type checked

Returns: A value specified by TSystemPaths

PhoneMemoryRootPath ( )

IMPORT_C const TDesC &PhoneMemoryRootPath()[static]

This method returns the root path in Phone Memory. Corresponding TSystemPaths value of the returned path is EPhoneMemoryRootPath.

See also: TSystemPaths

Returns: The root path in Phone Memory.

PicturesPath ( )

IMPORT_C const TDesC &PicturesPath()[static]

This method returns the pictures path to be appended to a root path. Corresponding TSystemPaths value of the returned path is EGsmPicturesPath.

DeprecatedUse GmsPicturesPath() instead.

See also: TSystemPaths

Returns: The pictures path.

PresenceLogosPath ( )

IMPORT_C const TDesC &PresenceLogosPath()[static]

This method returns the presence logos path to be appended to a root path. Corresponding TSystemPaths value of the returned path is EPresenceLogosPath.

See also: TSystemPaths

Returns: The presence logos path.

RomRootPath ( )

IMPORT_C const TDesC &RomRootPath()[static]

This method returns the root path in ROM. Corresponding TSystemPaths value of the returned path is ERomRootPath.

See also: TSystemPaths

Returns: The root path in ROM.

SimpleSoundsPath ( )

IMPORT_C const TDesC &SimpleSoundsPath()[static]

This method returns the simple sounds path to be appended to a root path. Corresponding TSystemPaths value of the returned path is ESimpleSoundsPath.

See also: TSystemPaths

Returns: The simple sound path.

SoundsPath ( )

IMPORT_C const TDesC &SoundsPath()[static]

This method returns the sounds path to be appended to a root path. Corresponding TSystemPaths value of the returned path is ESoundsPath.

See also: TSystemPaths

Returns: The sounds path.

VideosPath ( )

IMPORT_C const TDesC &VideosPath()[static]

This method returns the videos path to be appended to a root path. Corresponding TSystemPaths value of the returned path is EVideosPath.

See also: TSystemPaths

Returns: The videos path.