diff -r 13d7c31c74e0 -r b183ec05bd8c devicediagnosticsfw/diagpluginbase/src/diagpluginbaseutils.cpp --- a/devicediagnosticsfw/diagpluginbase/src/diagpluginbaseutils.cpp Thu Aug 19 10:44:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Collection of utility functions useful for plugins -* -*/ - - -// SYSTEM INCLUDE FILES -#include // BaflUtils -#include // RConeResourceLoader -#include // RFs -#include // KDC_RESOURCE_FILES_DIR -#include // LOGSTRING - -// USER INCLUDE FILES -#include "diagpluginbaseutils.h" // CDiagPluginUtils - -// ======== LOCAL FUNCTIONS ======== - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// DiagPluginBaseUtils::OpenResourceFileL() -// --------------------------------------------------------------------------- -// -void DiagPluginBaseUtils::OpenResourceFileL( - const TDesC& aResourceFileName, - RConeResourceLoader& aResourceLoader, - RFs& aFsSession ) - { - // Find the resource file: - TParse parse; - parse.Set( aResourceFileName, &KDC_RESOURCE_FILES_DIR, NULL ); - TFileName fileName( parse.FullName() ); - - // Get language of resource file: - BaflUtils::NearestLanguageFile( aFsSession, fileName ); - - LOGSTRING( "CDiagPluginBaseUtils::OpenLocalizedResourceFileL: FileName:" ) - LOGTEXT( fileName ) - - // Open resource file: - TRAPD( err, aResourceLoader.OpenL( fileName ) ) - -#ifdef _DEBUG - if ( err != KErrNone ) - { - // if it is a debug build, and it fails to load the resource, try - // again with C: as base directory. - // This allows installation of plug-ins as SIS file without changing - // code in the plug-in itself. - _LIT( KCDriveName, "c" ); - fileName.Replace( 0, 1, KCDriveName ); - - LOGSTRING( "CDiagPluginBaseUtils::OpenLocalizedResourceFileL: Retry:" ) - LOGTEXT( fileName ) - TRAP( err, aResourceLoader.OpenL( fileName ) ) - } -#endif // _DEBUG - - if ( err != KErrNone ) - { - LOGSTRING2( "CDiagPluginBaseUtils::OpenLocalizedResourceFileL:" - L" Failed err = %d", err ) - User::Leave( err ); - } - - LOGSTRING( "CDiagPluginBaseUtils::OpenLocalizedResourceFileL: Resource Opened" ) - } - -// End of File -