secureswitools/swisistools/source/sisxlibrary/siscontents.cpp
changeset 60 245df5276b97
parent 0 ba25891c3a9e
equal deleted inserted replaced
53:ae54820ef82c 60:245df5276b97
     1 /*
     1 /*
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2007-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".
    65 	}
    65 	}
    66 
    66 
    67 bool CSISContents::IsSisFile(const std::wstring& aFileName)
    67 bool CSISContents::IsSisFile(const std::wstring& aFileName)
    68 	{
    68 	{
    69 	TSISStream input;
    69 	TSISStream input;
       
    70 	#ifdef __TOOLS2_LINUX__
    70 	std::wstring fileName = FixPathDelimiters(aFileName);
    71 	std::wstring fileName = FixPathDelimiters(aFileName);
       
    72 	#else
       
    73 	std::wstring fileName = aFileName;
       
    74 	#endif
    71 	HANDLE file = ::MakeSISOpenFile(fileName.c_str(),GENERIC_READ,OPEN_EXISTING);
    75 	HANDLE file = ::MakeSISOpenFile(fileName.c_str(),GENERIC_READ,OPEN_EXISTING);
    72 	CSISException::ThrowIf ((INVALID_HANDLE_VALUE == file), 
    76 	CSISException::ThrowIf ((INVALID_HANDLE_VALUE == file), 
    73 							CSISException::EFileProblem, std::wstring (L"cannot open ") + fileName);
    77 							CSISException::EFileProblem, std::wstring (L"cannot open ") + fileName);
    74 	bool success = input.import (file, NULL);
    78 	bool success = input.import (file, NULL);
    75 	::CloseHandle(file);
    79 	::CloseHandle(file);
    97 
   101 
    98 
   102 
    99 void CSISContents::Load (const std::wstring& aFileName, TUint64* size)
   103 void CSISContents::Load (const std::wstring& aFileName, TUint64* size)
   100 	{
   104 	{
   101 	TSISStream input;
   105 	TSISStream input;
       
   106 	#ifdef __TOOLS2_LINUX__
   102 	std::wstring fileName = FixPathDelimiters(aFileName);
   107 	std::wstring fileName = FixPathDelimiters(aFileName);
       
   108 	#else
       
   109 	std::wstring fileName = aFileName;
       
   110 	#endif
   103 	HANDLE file = ::MakeSISOpenFile(fileName.c_str(),GENERIC_READ,OPEN_EXISTING);
   111 	HANDLE file = ::MakeSISOpenFile(fileName.c_str(),GENERIC_READ,OPEN_EXISTING);
   104 	if (INVALID_HANDLE_VALUE == file)
   112 	if (INVALID_HANDLE_VALUE == file)
   105 		{
   113 		{
   106 		SISLogger::Log(L" Error : Cannot open file : ");
   114 		SISLogger::Log(L" Error : Cannot open file : ");
   107 		SISLogger::Log(fileName);
   115 		SISLogger::Log(fileName);