1 /* |
1 /* |
2 * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of the License "Eclipse Public License v1.0" |
5 * under the terms of the License "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
121 const std::wstring& fileName = aParamList.ConfigFileName(); |
121 const std::wstring& fileName = aParamList.ConfigFileName(); |
122 |
122 |
123 if ( FileExists( fileName ) ) |
123 if ( FileExists( fileName ) ) |
124 { |
124 { |
125 std::string fName; |
125 std::string fName; |
126 fName = wstring2string( fileName ); |
126 fName = Ucs2ToUtf8( fileName ); |
127 // |
127 // |
128 std::ifstream stream; |
128 std::ifstream stream; |
129 stream.open( fName.c_str(), std::ios::binary ); |
129 stream.open( fName.c_str(), std::ios::binary ); |
130 // |
130 // |
131 try |
131 try |
201 if (aParamList.IsFlagSet(CParameterList::EFlagsCDriveSet)) |
201 if (aParamList.IsFlagSet(CParameterList::EFlagsCDriveSet)) |
202 { |
202 { |
203 CheckAndAddDrive(aParamList.SystemDriveLetter(), aParamList.SystemDrivePath()); |
203 CheckAndAddDrive(aParamList.SystemDriveLetter(), aParamList.SystemDrivePath()); |
204 } |
204 } |
205 |
205 |
206 if ((!IsTargetDrivePresent(aParamList.SystemDriveLetter())) && (!aParamList.IsFlagSet(CParameterList::EFlagsRomInstallSet))) |
206 if ( !IsTargetDrivePresent(aParamList.SystemDriveLetter()) ) |
207 { |
207 { |
208 std::stringstream err; |
208 std::stringstream err; |
209 err << "The directory representing the system drive is not defined"; |
209 err << "The directory representing the system drive is not defined"; |
210 throw ConfigManagerException( ConfigManagerException::ETypeDriveError, err.str()); |
210 throw ConfigManagerException( ConfigManagerException::ETypeDriveError, err.str()); |
211 } |
211 } |
212 |
|
213 if (!((aParamList.IsFlagSet(CParameterList::EFlagsCDriveSet)) ^ (aParamList.IsFlagSet(CParameterList::EFlagsRomInstallSet)))) |
|
214 { |
|
215 std::stringstream err; |
|
216 err << "The System Drive should not be defined for Installation to Rom Drive"; |
|
217 throw ConfigManagerException( ConfigManagerException::ETypeDriveError, err.str()); |
|
218 } |
|
219 |
|
220 if ((!aParamList.IsFlagSet(CParameterList::EFlagsCDriveSet)) && (aParamList.IsFlagSet(CParameterList::EFlagsExtDriveSet))) |
|
221 { |
|
222 std::stringstream err; |
|
223 err << "The Extended Drive cannot be specified without -c (System drive) option."; |
|
224 throw ConfigManagerException( ConfigManagerException::ETypeDriveError, err.str()); |
|
225 } |
|
226 |
|
227 } |
212 } |
228 |
213 |
229 |
214 |
230 void ConfigManager::SetValue( TUint32 aKey, TUint32 aValue ) |
215 void ConfigManager::SetValue( TUint32 aKey, TUint32 aValue ) |
231 { |
216 { |
395 // relevant to interpretsis. |
380 // relevant to interpretsis. |
396 // Instead a warning is produced. |
381 // Instead a warning is produced. |
397 std::ostringstream stream; |
382 std::ostringstream stream; |
398 stream << "Unsupported keyword at line " << aLineNumber << " of ini file [" << aKey << " = " << aValue << "] "; |
383 stream << "Unsupported keyword at line " << aLineNumber << " of ini file [" << aKey << " = " << aValue << "] "; |
399 stream << std::endl; |
384 stream << std::endl; |
400 std::wstring finalMessage = string2wstring( stream.str() ); |
385 std::wstring finalMessage = Utf8ToUcs2( stream.str() ); |
401 LWARN( finalMessage ); |
386 LWARN( finalMessage ); |
402 } |
387 } |
403 } |
388 } |
404 |
389 |
405 |
390 |
424 const ConfigAttribute* ConfigManager::AttributeByName( const std::string& aName ) |
409 const ConfigAttribute* ConfigManager::AttributeByName( const std::string& aName ) |
425 { |
410 { |
426 std::string upperCased( aName ); |
411 std::string upperCased( aName ); |
427 upperCased = StringUtils::ToUpper( upperCased ); |
412 upperCased = StringUtils::ToUpper( upperCased ); |
428 std::wstring searchFor; |
413 std::wstring searchFor; |
429 searchFor = string2wstring( upperCased ); |
414 searchFor = Utf8ToUcs2( upperCased ); |
430 // |
415 // |
431 const int attributeCount = sizeof( KConfigAttributes ) / sizeof( ConfigAttribute ); |
416 const int attributeCount = sizeof( KConfigAttributes ) / sizeof( ConfigAttribute ); |
432 const ConfigAttribute* ret = NULL; |
417 const ConfigAttribute* ret = NULL; |
433 // |
418 // |
434 for( int i=0; i<attributeCount; i++ ) |
419 for( int i=0; i<attributeCount; i++ ) |
627 if (it != iDrives.end()) |
612 if (it != iDrives.end()) |
628 { |
613 { |
629 char drive = aDrive; |
614 char drive = aDrive; |
630 std::stringstream warn; |
615 std::stringstream warn; |
631 warn << "Redefining drive: " << drive; |
616 warn << "Redefining drive: " << drive; |
632 std::wstring finalMessage = string2wstring( warn.str() ); |
617 std::wstring finalMessage = Utf8ToUcs2( warn.str() ); |
633 LWARN( finalMessage + L" to " + aDir); |
618 LWARN( finalMessage + L" to " + aDir); |
634 |
619 |
635 delete it->second; |
620 delete it->second; |
636 iDrives.erase(it); |
621 iDrives.erase(it); |
637 } |
622 } |
700 break; |
685 break; |
701 case ETypeInvalidDirectory: |
686 case ETypeInvalidDirectory: |
702 stream << "\'" << iValue << "\'" << " directory is not found"; |
687 stream << "\'" << iValue << "\'" << " directory is not found"; |
703 break; |
688 break; |
704 case ETypeDriveError: |
689 case ETypeDriveError: |
705 LERROR( string2wstring( iValue ) ); |
690 LERROR( Utf8ToUcs2( iValue ) ); |
706 return; |
691 return; |
707 |
692 |
708 default: |
693 default: |
709 stream << "Unknown error"; |
694 stream << "Unknown error"; |
710 break; |
695 break; |
711 } |
696 } |
712 // |
697 // |
713 stream << std::endl; |
698 stream << std::endl; |
714 std::wstring finalMessage = string2wstring( stream.str() ); |
699 std::wstring finalMessage = Utf8ToUcs2( stream.str() ); |
715 // |
700 // |
716 LERROR( finalMessage ); |
701 LERROR( finalMessage ); |
717 } |
702 } |
718 |
703 |