diff -r 0d72cc2a29a3 -r 7259cf1302ad memspy/Engine/Source/MemSpyEngineUtils.cpp --- a/memspy/Engine/Source/MemSpyEngineUtils.cpp Wed Jun 23 19:59:05 2010 +0300 +++ b/memspy/Engine/Source/MemSpyEngineUtils.cpp Tue Jul 06 16:05:13 2010 +0300 @@ -274,7 +274,7 @@ EXPORT_C TMemSpyPercentText MemSpyEngineUtils::FormatPercentage( TReal aOneHundredPercentValue, TReal aValue ) { - const TReal value = (TInt) (( aValue / aOneHundredPercentValue) * 100.0); + const TReal value = (( aValue / aOneHundredPercentValue) * 100.0); _LIT(KPercentFormat, "%3.2f %%"); @@ -365,6 +365,7 @@ EXPORT_C void MemSpyEngineUtils::GetFolderL( RFs& aFsSession, TDes& aFolder, const CMemSpyEngineSinkMetaData& aMetaData, const TDriveNumber* aForceDrive ) { const TChar KMemSpyDirectorySeparator = '\\'; + const TChar KMemSpyDriveSeparator = ':'; TDriveList drives; User::LeaveIfError( aFsSession.DriveList( drives ) ); @@ -379,7 +380,26 @@ } else { - logDrive = MemSpyEngineUtils::LocateSuitableDrive( aFsSession ); + // check if drive is specified in root path + if ( aMetaData.Root().Length() > 2 && aMetaData.Root()[1] == KMemSpyDriveSeparator ) + { + TChar drive = aMetaData.Root()[0]; + + // check if drive is valid + if (drives.Locate(drive) != KErrNone) + { + TDriveUnit driveUnit( aMetaData.Root().Left(1) ); + logDrive = static_cast(static_cast(driveUnit)); + } + else + { + logDrive = MemSpyEngineUtils::LocateSuitableDrive( aFsSession ); + } + } + else + { + logDrive = MemSpyEngineUtils::LocateSuitableDrive( aFsSession ); + } } // Prepare the drive buffer @@ -389,7 +409,35 @@ // Prepare the drive name TDriveUnit driveUnit( logDrive ); pFileName.Append( driveUnit.Name() ); - pFileName.Append( KMemSpyLogRootPath ); + + if ( aMetaData.Root().Length() == 0 ) + { + pFileName.Append( KMemSpyLogRootPath ); + } + else + { + TPtrC root( aMetaData.Root() ); + // check if root path contains drive (e.g. c:) and remove it + if ( root.Length() > 2 && root[1] == KMemSpyDriveSeparator ) + { + root.Set( root.Mid( 2 ) ); + } + // check if root starts with \ and remove it + if ( root.Length() > 1 && root[0] == KMemSpyDirectorySeparator ) + { + root.Set( root.Mid( 1 ) ); + } + + // append root path + pFileName.Append( KMemSpyDirectorySeparator ); + pFileName.Append( root ); + + // add trailing slash if necessary + if ( root[root.Length() - 1] != KMemSpyDirectorySeparator ) + { + pFileName.Append( KMemSpyDirectorySeparator ); + } + } // Add any custom folder information if ( aMetaData.Folder().Length() > 0 )