2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Interface for quering system paths.
29 * Class holds information of system paths. Platform Environment API provides
30 * interface for quering system paths. Methods provided by the API should be
31 * used instead of hard coded path names. All paths have the trailing backslash
32 * included. The API consist of the PathInfo class, DriveInfo class and system paths are defined
33 * in PathConfiguration.hrh. The DriveInfo class is defined in DriveInfo.h.
38 * #include <PathInfo.h>
40 * // Get the root path of Phone Memory.
41 * TFileName path = PathInfo::PhoneMemoryRootPath();
43 * // Get the games path and append the path to the root path of Phone Memory.
44 * path.Append( PathInfo::GamesPath() );
46 * // 'path' contains now the games path in Phone Memory.
51 * The panic mechanism is used to handle programming errors.
52 * GetPath(TInt aPath) method will panic if invalid parameter is given as input.
53 * The panic category is named PATHINFO and panic code is:
55 * - EInvalidParameter = 0 (Invalid parameter.)
57 * @lib PlatformEnv.dll
66 * Enumeration System Paths defines values to be used for the aPath parameter
67 * in GetPath and GetFullPath methods.
72 /** This value is used only as a return value of PathType() to indicate that
73 * the path is not a system path. It is not a valid system path to be given
74 * as a parameter for GetPath() or GetFullPath()
77 /** To get the root path in ROM.
80 /** To get the root path in Phone Memory..
83 /** To get the root path in Memory Card.
86 /** To get the games path to be appended to a root path.
89 /** To get the installs path to be appended to a root path.
92 /** To get the others path to be appended to a root path.
95 /** To get the videos path to be appended to a root path.
98 /** To get the images path to be appended to a root path.
101 /** To get the GSM pictures path to be appended to a root path.
104 /** To get the MMS pictures path to be appended to a root path.
106 EMmsBackgroundImagesPath,
107 /** To get the presence logos path to be appended to a root path.
110 /** To get the sounds path to be appended to a root path.
113 /** To get the digital sounds path to be appended to a root path.
116 /** To get the simple sounds path to be appended to a root path.
119 /** To get the images thumbnail path.
120 * The thumbnail images directory exists under the same directory
121 * where the corresponding image is.
122 * Do not try to append this to a root directory.
124 EImagesThumbnailPath,
125 /** To get the full path of the contacts folder in the memory card.
126 * The path also contains the drive letter. Do not try to append
127 * this to any root directory.
129 EMemoryCardContactsPath
134 * This method returns the root path in ROM.
135 * Corresponding TSystemPaths value of the returned path is ERomRootPath.
137 * @return The root path in ROM.
141 IMPORT_C static const TDesC& RomRootPath();
143 * This method returns the root path in Phone Memory.
144 * Corresponding TSystemPaths value of the returned path is EPhoneMemoryRootPath.
146 * @return The root path in Phone Memory.
150 IMPORT_C static const TDesC& PhoneMemoryRootPath();
152 * This method returns the root path in Memory Card.
153 * Corresponding TSystemPaths value of the returned path is EMemoryCardRootPath.
155 * @return The root path in Memory Card.
159 IMPORT_C static const TDesC& MemoryCardRootPath();
163 * This method returns the games path to be appended to a root path.
164 * Corresponding TSystemPaths value of the returned path is EGamesPath.
166 * @return The games path.
170 IMPORT_C static const TDesC& GamesPath();
172 * This method returns the installs path to be appended to a root path.
173 * Corresponding TSystemPaths value of the returned path is EInstallsPath.
175 * @return The installs path.
179 IMPORT_C static const TDesC& InstallsPath();
181 * This method returns the others path to be appended to a root path.
182 * Corresponding TSystemPaths value of the returned path is EOthersPath.
184 * @return The installs path.
188 IMPORT_C static const TDesC& OthersPath();
190 * This method returns the videos path to be appended to a root path.
191 * Corresponding TSystemPaths value of the returned path is EVideosPath.
193 * @return The videos path.
197 IMPORT_C static const TDesC& VideosPath();
199 * This method returns the images path to be appended to a root path.
200 * Corresponding TSystemPaths value of the returned path is EImagesPath.
202 * @return The images path.
206 IMPORT_C static const TDesC& ImagesPath();
208 * This method returns the pictures path to be appended to a root path.
209 * Corresponding TSystemPaths value of the returned path is EGsmPicturesPath.
211 * @return The pictures path.
213 * @deprecated Use GmsPicturesPath() instead.
217 IMPORT_C static const TDesC& PicturesPath();
219 * This method returns the GMS pictures path to be appended to
221 * Corresponding TSystemPaths value of the returned path is EGsmPicturesPath.
223 * @return The GSM pictures path.
227 IMPORT_C static const TDesC& GmsPicturesPath();
229 * This method returns the MMS background images path to be appended to
231 * Corresponding TSystemPaths value of the returned path is EMmsBackgroundImagesPath.
233 * @return The MMS background images path.
237 IMPORT_C static const TDesC& MmsBackgroundImagesPath();
239 * This method returns the presence logos path to be appended to
241 * Corresponding TSystemPaths value of the returned path is EPresenceLogosPath.
243 * @return The presence logos path.
247 IMPORT_C static const TDesC& PresenceLogosPath();
249 * This method returns the sounds path to be appended to a root path.
250 * Corresponding TSystemPaths value of the returned path is ESoundsPath.
252 * @return The sounds path.
256 IMPORT_C static const TDesC& SoundsPath();
258 * This method returns the digital sounds path to be appended to
260 * Corresponding TSystemPaths value of the returned path is EDigitalSoundsPath.
262 * @return The digital sounds path.
266 IMPORT_C static const TDesC& DigitalSoundsPath();
268 * This method returns the simple sounds path to be appended to
270 * Corresponding TSystemPaths value of the returned path is ESimpleSoundsPath.
272 * @return The simple sound path.
276 IMPORT_C static const TDesC& SimpleSoundsPath();
278 // ---------------------------------------------------------------------
279 // Paths that are not necessarily under root directories
280 // ---------------------------------------------------------------------
283 * This method returns a thumbnail images path. The thumbnail images
284 * directory exists under the same directory where the corresponding
285 * image is. Do not try to append this to a root directory.
286 * Corresponding TSystemPaths value of the returned path is EImagesThumbnailPath.
288 * @return The thumbnail images path.
292 IMPORT_C static const TDesC& ImagesThumbnailPath();
295 * This method returns the full path of the contacts folder in
296 * the memory card. The path also contains the drive letter.
297 * Do not try to append this to any root directory.
298 * Corresponding TSystemPaths value of the returned path is EMemoryCardContactsPath.
300 * @return The full path of the contacts folder in the memory card.
304 IMPORT_C static const TDesC& MemoryCardContactsPath();
307 * This method returns the requested system path.
310 * @param aPath Defines the requested system path.
311 * @return The requested system path.
313 * @panic EInvalidParameter Parameter aPath is invalid.
315 * One small sample describing the usage of the method.
317 * #include <PathInfo.h>
319 * // Get the the full path of the contacts folder in the memory card.
320 * TFileName path = PathInfo::GetPath( PathInfo::EMemoryCardContactsPath );
322 * // 'path' contains now the full path of the contacts folder in the memory card..
327 IMPORT_C static const TDesC& GetPath( TInt aPath );
330 * This method gets the root path of the requested drive.
331 * The root path is the path where the system paths are located.
334 * @param aRootPath Stores the path, the maximum path length is KMaxPath.
335 * @param aDrive A drive identifier specified by TDriveNumber.
336 * @return A system wide error code.
338 * One small sample describing the usage of the method.
340 * #include <PathInfo.h>
341 * #include <DriveInfo.h>
343 * // Get the root path of the default phone memory.
345 * User::LeaveIfError( DriveInfo::GetDefaultDrive(
346 * DriveInfo::EDefaultPhoneMemory, drive ) );
348 * User::LeaveIfError( PathInfo::GetRootPath( path, drive ) );
350 * // 'path' contains now the default folder root path of the default phone memory.
357 IMPORT_C static TInt GetRootPath( TDes& aRootPath, TInt aDrive );
360 * This method gets the full path of the requested system path in the requested drive.
361 * KErrNotFound is returned when the drive has no requested system path or
362 * the requested path cannot be added to the root path.
365 * @param aFullPath Stores the requested path, the maximum path length is KMaxPath.
366 * @param aDrive A drive identifier specified by TDriveNumber.
367 * @param aPath Defines the requested system path.
368 * @return A system wide error codes.
370 * One small sample describing the usage of the method.
372 * #include <PathInfo.h>
373 * #include <DriveInfo.h>
375 * // Get the full path of the images folder in the default
376 * // phone memory drive.
379 * User::LeaveIfError( DriveInfo::GetDefaultDrive(
380 * DriveInfo::EDefaultPhoneMemory, drive ) );
381 * User::LeaveIfError( PathInfo::GetFullPath( path, drive, PathInfo::EImages ) );
383 * // 'path' contains now the full path of the images folder in the default
384 * // phone memory drive.
392 IMPORT_C static TInt GetFullPath( TDes& aFullPath, TInt aDrive, TInt aPath );
395 * This method returns the system path type of the given path.
396 * Thumbnail system path can exist in any folder.
397 * Other paths must be exact system paths, not subfolders of a system path
398 * ENotSystemPath is returned, if the path is not a system path.
399 * The given path must have backslash ending.
402 * @param aFullPath A path to be type checked
403 * @return A value specified by TSystemPaths
405 * One small sample describing the usage of the method.
407 * #include <PathInfo.h>
409 * // Check the type of the system path.
410 * _LIT( KImagesPath, "E:\\Images\\" );
411 * TInt type( PathInfo::PathType( KImagesPath ) );
413 * // 'type' contains now the EImagesPath value.
418 IMPORT_C static TInt PathType( const TDesC& aFullPath );
421 * This method gets the list of full system paths in the requested drive
422 * and leaves the returned pointer in cleanup stack.
425 * @param aDrive A drive identifier specified by TDriveNumber.
426 * @return A list of the system paths. Ownership is transferred.
428 * One small sample describing the usage of the method.
430 * #include <PathInfo.h>
431 * #include <DriveInfo.h>
433 * // Create the default path structure for default mass storage drive
435 * User::LeaveIfError( DriveInfo::GetDefaultDrive(
436 * DriveInfo::EDefaultMassStorage, drive ) );
437 * CDesCArray* paths = PathInfo::GetListOfPathsLC( drive );
438 * TInt count( paths->MdcaCount() );
439 * for ( TInt i( 0 ); i < count; ++i )
441 * User::LeaveIfError( iFs.MkDirAll( paths->MdcaPoint( i ) );
443 * CleanupStack::PopAndDestroy( paths );
444 * // The default mass storage drive contains now the default path structure
450 IMPORT_C static CDesCArray* GetListOfPathsLC( TInt aDrive );
453 * This method gets the list of full system paths in the requested drive.
456 * @param aDrive A drive identifier specified by TDriveNumber.
457 * @return A list of the system paths. Ownership is transferred.
461 IMPORT_C static CDesCArray* GetListOfPathsL( TInt aDrive );
466 * C++ default constructor.
471 #endif // PATH_INFO_H