secureswitools/swisistools/source/interpretsis/commandparser.cpp
branchRCL_3
changeset 81 42552535c1ac
parent 73 79647526f98c
equal deleted inserted replaced
73:79647526f98c 81:42552535c1ac
     1 /*
     1 /*
     2 * Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2006-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".
   168 		<< "\tsucert\t\tTo indicate that the SIS file has been signed with a SU certificate\n\n";
   168 		<< "\tsucert\t\tTo indicate that the SIS file has been signed with a SU certificate\n\n";
   169     }
   169     }
   170 
   170 
   171 void CCommandParser::DisplayVersion()
   171 void CCommandParser::DisplayVersion()
   172 	{
   172 	{
   173 	std::cout << "\nINTERPRETSIS  " << " Version  2.2.0 ." << std::endl;
   173 	std::cout << "\nINTERPRETSIS  " << " Version  2.1.3 ." << std::endl;
   174 	std::cout << "Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.\n " << std::endl;
   174 	std::cout << "Copyright (c) 2009 Symbian Software Ltd. All rights reserved.\n " << std::endl;
   175 	}
   175 	}
   176  
   176  
   177 
   177 
   178 CParameterList* CCommandParser::ParseOptions(int argc, const char**argv)
   178 CParameterList* CCommandParser::ParseOptions(int argc, const char**argv)
   179     {
   179     {
   384 				aParamList->SetZDrive(*(++argv));
   384 				aParamList->SetZDrive(*(++argv));
   385 				break;
   385 				break;
   386 				}
   386 				}
   387 			default:
   387 			default:
   388 				{
   388 				{
   389 				LERROR(string2wstring(std::string(optPtr)));
   389 				LERROR(Utf8ToUcs2(std::string(optPtr)));
   390 				throw CCommandParser::ECmdLineUnknownOption;
   390 				throw CCommandParser::ECmdLineUnknownOption;
   391 				}
   391 				}
   392 			}
   392 			}
   393 
   393 
   394 		if (err)
   394 		if (err)
   445 	std::string::const_iterator currentPos = it;
   445 	std::string::const_iterator currentPos = it;
   446     //
   446     //
   447 	while (currentPos != end)
   447 	while (currentPos != end)
   448 	    {
   448 	    {
   449 		currentPos = std::find(it, end, ',');
   449 		currentPos = std::find(it, end, ',');
   450 		std::wstring x = string2wstring(std::string(it,(currentPos-it)));
   450 		std::wstring x;
       
   451 		Utf8ToUcs2(std::string(it,(currentPos-it)), x);
   451 		//aOptionsList.push_back(x);
   452 		//aOptionsList.push_back(x);
   452 		(aParamList.*aFilePtr)(x);
   453 		(aParamList.*aFilePtr)(x);
   453 
   454 
   454 		if (currentPos == end)
   455 		if (currentPos == end)
   455 			{
   456 			{
   472 	currentPos = std::find(it, end, ',');
   473 	currentPos = std::find(it, end, ',');
   473 
   474 
   474 	while (currentPos != end)
   475 	while (currentPos != end)
   475 	    {
   476 	    {
   476 		currentPos = std::find(it, end, ',');
   477 		currentPos = std::find(it, end, ',');
   477 		std::wstring x = string2wstring(std::string(it,(currentPos-it)));
   478 		std::wstring x;
       
   479 		Utf8ToUcs2(std::string(it,(currentPos-it)), x);
   478 
   480 
   479 		InstallSISFile sisFileName(x, '$', false);
   481 		InstallSISFile sisFileName(x, '$', false);
   480 		aParamList.AddSISFile(sisFileName);
   482 		aParamList.AddSISFile(sisFileName);
   481 
   483 
   482 		if (currentPos == end)
   484 		if (currentPos == end)
   490 	
   492 	
   491 	// At this stage, aArgv could be something like: file.sis +e +mcard +sucert
   493 	// At this stage, aArgv could be something like: file.sis +e +mcard +sucert
   492 	// As the sisfile attributes are predetermined input, therefore we can just
   494 	// As the sisfile attributes are predetermined input, therefore we can just
   493 	// parse according to the predetermined inputs.
   495 	// parse according to the predetermined inputs.
   494 
   496 
   495 	std::wstring fileName = string2wstring(sisFileOption);
   497 	std::wstring fileName;
       
   498 	Utf8ToUcs2(sisFileOption, fileName);
   496 
   499 
   497 	InstallSISFile sisFileName(fileName, '$', false);
   500 	InstallSISFile sisFileName(fileName, '$', false);
   498 		
   501 		
   499 	while (--aArgc > 0)
   502 	while (--aArgc > 0)
   500 		{ // Process associated SIS file attributes
   503 		{ // Process associated SIS file attributes
   521 				// Found the associated SIS file drive; e.g. +e
   524 				// Found the associated SIS file drive; e.g. +e
   522 				const char* optPtr = *aArgv;
   525 				const char* optPtr = *aArgv;
   523 
   526 
   524 				char drive = tolower(*++optPtr);
   527 				char drive = tolower(*++optPtr);
   525 
   528 
   526 				if (drive < 'a' || drive > 'z')
   529 				if (drive < 'a' || drive > 'y')
   527 					throw CCommandParser::ECmdLineInvalidSISFileAttribute;
   530 					throw CCommandParser::ECmdLineInvalidSISFileAttribute;
   528 
   531 
   529 				if(drive == 'z')
       
   530 					{
       
   531 					aParamList.SetFlag(CParameterList::EFlagsRomInstallSet);
       
   532 					sisFileName.iGenerateRomStub = true;
       
   533 					sisFileName.iNotRegister = true;
       
   534 					}
       
   535 				else
       
   536 					{
       
   537 					aParamList.SetFlag(CParameterList::EFlagsExtDriveSet);
       
   538 					}
       
   539 				// Set target drive
   532 				// Set target drive
   540 				sisFileName.iTargetDrive = drive;
   533 				sisFileName.iTargetDrive = drive;
   541 
   534 
   542 				continue;
   535 				continue;
   543 				}
   536 				}