secureswitools/swisistools/source/scrtool/main.cpp
branchRCL_3
changeset 25 7333d7932ef7
parent 0 ba25891c3a9e
child 26 8b7f4e561641
equal deleted inserted replaced
24:5cc91383ab1e 25:7333d7932ef7
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2009-2010 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".
    35 	{
    35 	{
    36 	int returnCode = 0;
    36 	int returnCode = 0;
    37 
    37 
    38 	try
    38 	try
    39 		{
    39 		{
    40 		const char* epocRoot = getenv("EPOCROOT");
    40 		const char* epocRoot = getenv("EPOCROOT");		
    41 		if(NULL == epocRoot)
    41 		if(NULL == epocRoot)
    42 			{
    42 			{
    43 			throw CException("EPOCROOT environment variable not specified.", ExceptionCodes::EEnvNotSpecified);
    43 			throw CException("EPOCROOT environment variable not specified.", ExceptionCodes::EEnvNotSpecified);
    44 			}
    44 			}
    45 		std::string epocRootStr(epocRoot); 
    45 		std::string epocRootStr(epocRoot); 
    47 		COptions options(argc, argv);
    47 		COptions options(argc, argv);
    48 
    48 
    49 		std::string logFileName(options.GetLogFileName());
    49 		std::string logFileName(options.GetLogFileName());
    50 		std::auto_ptr<CLogger> logger(new CLogger(logFileName, options.GetLogLevel()));
    50 		std::auto_ptr<CLogger> logger(new CLogger(logFileName, options.GetLogLevel()));
    51 		
    51 		
    52 		std::string dllPath = "sqlite3.dll";
    52    #ifdef __LINUX__
       
    53   	  	 std::string dllPath = "sqlite-3.6.1.so";
       
    54    #else
       
    55  	       std::string dllPath = "sqlite3.dll";
       
    56    #endif
       
    57   	  	 	 
    53 		std::auto_ptr<CDbLayer> db( new CDbLayer(dllPath, options.GetDbFileName()));
    58 		std::auto_ptr<CDbLayer> db( new CDbLayer(dllPath, options.GetDbFileName()));
    54 		std::auto_ptr<CScrXmlParser> xmlParser( new CScrXmlParser());
    59 		std::auto_ptr<CScrXmlParser> xmlParser( new CScrXmlParser());
    55 
    60 
    56 		if(options.IsDbAbsent())
    61 		if(options.IsDbAbsent())
    57 			{
    62 			{
       
    63 		  #ifdef __LINUX__ 		  
       
    64 			std::string dbFileName = epocRootStr + "epoc32/tools/create_db.xml";
       
    65 			#else
    58 			std::string dbFileName = epocRootStr + "epoc32\\tools\\create_db.xml";
    66 			std::string dbFileName = epocRootStr + "epoc32\\tools\\create_db.xml";
       
    67 			#endif
       
    68 			
    59 			std::auto_ptr<SchemaDetails> schema(xmlParser->ParseDbSchema(dbFileName));
    69 			std::auto_ptr<SchemaDetails> schema(xmlParser->ParseDbSchema(dbFileName));
    60 			db->CreateScrDatabase(*schema);
    70 			db->CreateScrDatabase(*schema);
    61 			}
    71 			}
    62 
    72 
    63 		std::vector<std::string> xmlFileNames = options.GetEnvFileNames();
    73 		std::vector<std::string> xmlFileNames = options.GetEnvFileNames();