276 // |
276 // |
277 HBufC* CHnMdValueImage::FindMatchigMifFileL( const RFs& aFs, TDesC& aFileName ) |
277 HBufC* CHnMdValueImage::FindMatchigMifFileL( const RFs& aFs, TDesC& aFileName ) |
278 { |
278 { |
279 DEBUG16(("_MM_: CHnMdValueImage::FindMatchigMifFileL IN")); |
279 DEBUG16(("_MM_: CHnMdValueImage::FindMatchigMifFileL IN")); |
280 |
280 |
|
281 _LIT( KGridRootMif, "gridroot.mif" ); |
|
282 |
281 // whole path to the mif file was not specified |
283 // whole path to the mif file was not specified |
282 TDriveList driveList; |
284 TDriveList driveList; |
283 HBufC* ret = NULL; |
285 HBufC* ret = NULL; |
284 |
286 |
285 if ( KErrNone == aFs.DriveList( driveList ) ) |
287 if ( aFileName == KGridRootMif ) |
|
288 { |
|
289 ret = HBufC::NewL( |
|
290 1 + KRscPath().Length() + // 1 - drive letter len. |
|
291 aFileName.Length() ); |
|
292 TPtr ptr( ret->Des() ); |
|
293 TChar driveLetter; |
|
294 aFs.DriveToChar( EDriveZ, driveLetter ); |
|
295 ptr.Append( driveLetter ); |
|
296 ptr.Append( KRscPath ); |
|
297 ptr.Append( aFileName ); |
|
298 } |
|
299 else if ( KErrNone == aFs.DriveList( driveList ) ) |
286 { |
300 { |
287 TInt driveNumber( EDriveY ); // start with drive Y |
301 TInt driveNumber( EDriveY ); // start with drive Y |
288 do // iterates through drives: Y, X, W, ..., C, B, A, Z |
302 do // iterates through drives: Y, X, W, ..., C, B, A, Z |
289 { |
303 { |
290 if ( driveList[ driveNumber ] ) |
304 if ( driveList[ driveNumber ] ) |
334 HBufC* ret = NULL; |
348 HBufC* ret = NULL; |
335 RBuf tmpBuf; |
349 RBuf tmpBuf; |
336 CleanupClosePushL( tmpBuf ); |
350 CleanupClosePushL( tmpBuf ); |
337 |
351 |
338 TInt errCode = HnLiwUtils::GetStringL( *iParamList, iMifFile8, iPos, tmpBuf ); |
352 TInt errCode = HnLiwUtils::GetStringL( *iParamList, iMifFile8, iPos, tmpBuf ); |
339 if ( !BaflUtils::FileExists( iCmnPtrs->iFs, tmpBuf ) && tmpBuf.Length() ) |
353 if ( tmpBuf.Length() ) |
340 { |
354 { |
341 // fileName was retrieved but corresponding file was not found |
355 if ( BaflUtils::FileExists( iCmnPtrs->iFs, tmpBuf ) ) |
342 ret = FindMatchigMifFileL( iCmnPtrs->iFs, tmpBuf ); |
356 { |
343 } |
357 // return fileName as it is |
344 else if ( tmpBuf.Length() ) |
358 ret = tmpBuf.AllocL(); |
345 { |
359 } |
346 // return fileName as it is |
360 else |
347 ret = tmpBuf.AllocL(); |
361 { |
|
362 // fileName was retrieved but corresponding file was not found |
|
363 ret = FindMatchigMifFileL( iCmnPtrs->iFs, tmpBuf ); |
|
364 } |
348 } |
365 } |
349 |
366 |
350 // clean up |
367 // clean up |
351 CleanupStack::PopAndDestroy( &tmpBuf ); |
368 CleanupStack::PopAndDestroy( &tmpBuf ); |
352 |
369 |