196 if( error != KErrNone ) |
196 if( error != KErrNone ) |
197 { |
197 { |
198 continue; |
198 continue; |
199 } |
199 } |
200 HBufC* pathBuf = path.AllocL(); |
200 HBufC* pathBuf = path.AllocL(); |
201 aPaths.Append( pathBuf ); |
201 CleanupStack::PushL( pathBuf ); |
|
202 aPaths.AppendL( pathBuf ); |
|
203 CleanupStack::Pop( pathBuf ); |
202 } |
204 } |
203 |
205 |
204 CleanupStack::PopAndDestroy( &scanPathKeys ); |
206 CleanupStack::PopAndDestroy( &scanPathKeys ); |
205 CleanupStack::PopAndDestroy( repo ); |
207 CleanupStack::PopAndDestroy( repo ); |
206 } |
208 } |
212 CleanupClosePushL( scanPathKeys ); |
214 CleanupClosePushL( scanPathKeys ); |
213 |
215 |
214 repo->FindL( aPartialKey, KSearchMask, scanPathKeys ); |
216 repo->FindL( aPartialKey, KSearchMask, scanPathKeys ); |
215 |
217 |
216 TBuf<KMaxFileName> path; |
218 TBuf<KMaxFileName> path; |
|
219 |
217 for( TInt i = scanPathKeys.Count() - 1; i >=0; i-- ) |
220 for( TInt i = scanPathKeys.Count() - 1; i >=0; i-- ) |
218 { |
221 { |
219 const TInt error( repo->Get( scanPathKeys[i], path ) ); |
222 const TInt error( repo->Get( scanPathKeys[i], path ) ); |
|
223 |
220 if( error != KErrNone ) |
224 if( error != KErrNone ) |
221 { |
225 { |
222 continue; |
226 continue; |
223 } |
227 } |
224 TUint32 preinstalled = MdeConstants::MediaObject::ENotPreinstalled; |
228 TUint32 preinstalled = MdeConstants::MediaObject::ENotPreinstalled; |
|
229 |
225 if( path[ path.Length() - 1 ] != TChar('\\') ) |
230 if( path[ path.Length() - 1 ] != TChar('\\') ) |
226 { |
231 { |
227 User::LeaveIfError( repo->GetMeta( scanPathKeys[i], preinstalled ) ); |
232 User::LeaveIfError( repo->GetMeta( scanPathKeys[i], preinstalled ) ); |
228 } |
233 } |
229 TScanItem* item = new (ELeave) TScanItem(); |
234 TScanItem* item = new (ELeave) TScanItem(); |
230 CleanupStack::PushL( item ); |
235 CleanupStack::PushL( item ); |
231 item->iPath = path.AllocL(); |
236 item->iPath = path.AllocL(); |
232 item->iPreinstalled = preinstalled; |
237 item->iPreinstalled = preinstalled; |
233 CleanupStack::Pop( item ); |
238 CleanupStack::Pop( item ); |
234 aItems.Append( item ); // ownership is transferred |
239 aItems.AppendL( item ); // ownership is transferred |
235 } |
240 } |
236 |
241 |
237 CleanupStack::PopAndDestroy( &scanPathKeys ); |
242 CleanupStack::PopAndDestroy( &scanPathKeys ); |
238 CleanupStack::PopAndDestroy( repo ); |
243 CleanupStack::PopAndDestroy( repo ); |
239 } |
244 } |