|
1 /* |
|
2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implementation of Metadata dialog |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // CLASS HEADER |
|
22 #include "glxresourceutilities.h" |
|
23 |
|
24 // EXTERNAL INCLUDES |
|
25 #include <bautils.h> |
|
26 #include <AknUtils.h> |
|
27 #include <f32file.h> |
|
28 |
|
29 // INTERNAL INCLUDES |
|
30 #include <glxtracer.h> |
|
31 |
|
32 // --------------------------------------------------------------------------- |
|
33 // GetResourceFilenameL |
|
34 // --------------------------------------------------------------------------- |
|
35 // |
|
36 EXPORT_C void CGlxResourceUtilities::GetResourceFilenameL( TFileName& aResFile ) |
|
37 { |
|
38 TRACER("CGlxResourceUtilities::GetResourceFilenameL( TFileName& aResFile)"); |
|
39 |
|
40 RFs fs; |
|
41 User::LeaveIfError( fs.Connect() ); |
|
42 CleanupClosePushL( fs ); |
|
43 CGlxResourceUtilities::GetResourceFilenameL( aResFile, fs ); |
|
44 CleanupStack::PopAndDestroy( &fs ); |
|
45 } |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // GetResourceFilenameL |
|
49 // --------------------------------------------------------------------------- |
|
50 // |
|
51 EXPORT_C void CGlxResourceUtilities::GetResourceFilenameL( TFileName& aResFile, RFs& aFs ) |
|
52 { |
|
53 TRACER("CGlxResourceUtilities::GetResourceFilenameL( TFileName& aResFile, RFs& aFs )"); |
|
54 |
|
55 // don't use AknUtils CompleteWithAppPath |
|
56 aResFile.Insert( 0, TDriveUnit( EDriveC).Name() ); |
|
57 // try to locate the localised resource |
|
58 BaflUtils::NearestLanguageFile( aFs, aResFile ); |
|
59 // if the localised resource is found, the file name is changed to |
|
60 // the localised name (z:\apps\resources\xxx.r001) |
|
61 if( !BaflUtils::FileExists( aFs, aResFile ) ) |
|
62 { |
|
63 // not found on c drive, try z |
|
64 aResFile.Replace( 0, KMaxDriveName, TDriveUnit( EDriveZ ).Name() ); |
|
65 // try to locate the localised resource again |
|
66 BaflUtils::NearestLanguageFile( aFs, aResFile ); |
|
67 // if file was not found this time, there is no localised |
|
68 // resource with the name |
|
69 if (!BaflUtils::FileExists( aFs, aResFile ) ) |
|
70 { |
|
71 User::Leave( KErrNotFound ); |
|
72 } |
|
73 } |
|
74 } |
|
75 |
|
76 |