secureswitools/swisistools/source/interpretsislib/installablefile.cpp
branchRCL_3
changeset 62 5cc91383ab1e
parent 0 ba25891c3a9e
child 73 79647526f98c
child 75 2d2d25361590
equal deleted inserted replaced
61:cd189dac02f7 62:5cc91383ab1e
     1 /*
     1 /*
     2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2006-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".
    42   iFileDescription(&aFdes),
    42   iFileDescription(&aFdes),
    43   iFileData(aFdata),
    43   iFileData(aFdata),
    44   iTargetFile(aFdes.Target().GetString()),
    44   iTargetFile(aFdes.Target().GetString()),
    45   iLocalTargetFile(aFdes.Target().GetString())
    45   iLocalTargetFile(aFdes.Target().GetString())
    46 {
    46 {
       
    47 	// Transforming the file path into lower case to maintain consistency
       
    48 	// between Windows and Linux as Linux path is case-sensitive.
       
    49 	std::transform(iTargetFile.begin(), iTargetFile.end(), iTargetFile.begin(), tolower);
       
    50 	std::transform(iLocalTargetFile.begin(), iLocalTargetFile.end(), iLocalTargetFile.begin(), tolower);
       
    51 
    47 	// Update the installing file with the actual target drive letter
    52 	// Update the installing file with the actual target drive letter
    48 	ChangeTargetDrive(aDrivePath, aInstallingDrive);
    53 	ChangeTargetDrive(aDrivePath, aInstallingDrive);
    49 
    54 
    50 	// warn the user if they are using a winscw emulator binary
    55 	// warn the user if they are using a winscw emulator binary
    51 	if (aFdata->IsEmulatorExecutable())
    56 	if (aFdata->IsEmulatorExecutable())
    52 			LWARN(iTargetFile << L" is an emulator binary!");
    57 			LWARN(iTargetFile.c_str() << L" is an emulator binary!");
    53 }
    58 }
    54 
    59 
    55 // PA SIS files		
    60 // PA SIS files		
    56 InstallableFile::InstallableFile(const CSISFileDescription& aFdes, const std::wstring aDrivePath,
    61 InstallableFile::InstallableFile(const CSISFileDescription& aFdes, const std::wstring aDrivePath,
    57 								 int aInstallingDrive)
    62 								 int aInstallingDrive)
    62   iFileData(0),
    67   iFileData(0),
    63   isStub(true),
    68   isStub(true),
    64   iTargetFile(aFdes.Target().GetString()),
    69   iTargetFile(aFdes.Target().GetString()),
    65   iLocalTargetFile(aFdes.Target().GetString())
    70   iLocalTargetFile(aFdes.Target().GetString())
    66   {
    71   {
       
    72 	// Transforming the file path into lower case to maintain consistency
       
    73 	// between Windows and Linux as Linux path is case-sensitive.
       
    74 	std::transform(iTargetFile.begin(), iTargetFile.end(), iTargetFile.begin(), tolower);
       
    75 	std::transform(iLocalTargetFile.begin(), iLocalTargetFile.end(), iLocalTargetFile.begin(), tolower);
       
    76 
    67 	// Update the installing file with the actual target drive letter
    77 	// Update the installing file with the actual target drive letter
    68 	ChangeTargetDrive(aDrivePath, aInstallingDrive);
    78 	ChangeTargetDrive(aDrivePath, aInstallingDrive);
    69 
    79 
    70 		// retrieve the file attributes e.g. exe, dll, SID etc.
    80 		// retrieve the file attributes e.g. exe, dll, SID etc.
    71 	const bool fileExists = FileExists( iLocalTargetFile );
    81 	const bool fileExists = FileExists( iLocalTargetFile );
    84 				isExe = true;
    94 				isExe = true;
    85 				isExecutable = true;
    95 				isExecutable = true;
    86 				iSid = info.iSecureId;
    96 				iSid = info.iSecureId;
    87 				
    97 				
    88 				if(fileType & EFileEmulatorExe)
    98 				if(fileType & EFileEmulatorExe)
    89 					LWARN(iTargetFile << L" is an emulator binary!");
    99 					LWARN(iTargetFile.c_str() << L" is an emulator binary!");
    90 				}
   100 				}
    91 			else if (fileType & EFileDll)
   101 			else if (fileType & EFileDll)
    92 				{
   102 				{
    93 				isExecutable = true;
   103 				isExecutable = true;
    94 				}
   104 				}
   109 
   119 
   110 void InstallableFile::ChangeTargetDrive(const std::wstring aDrivePath, int aInstallingDrive)
   120 void InstallableFile::ChangeTargetDrive(const std::wstring aDrivePath, int aInstallingDrive)
   111 {
   121 {
   112 	// get the local path
   122 	// get the local path
   113 	ConvertToLocalPath(iLocalTargetFile,aDrivePath);
   123 	ConvertToLocalPath(iLocalTargetFile,aDrivePath);
       
   124 #ifdef __TOOLS2_LINUX__
       
   125 	ConvertToForwardSlash(iTargetFile);
       
   126 #endif
   114 
   127 
   115 	// change the drive letter
   128 	// change the drive letter
   116 	if (StringUtils::StartsWithDrive(iTargetFile))
   129 	if (StringUtils::StartsWithDrive(iTargetFile))
   117 	{
   130 	{
   118 		std::wstring target(iTargetFile);
   131 		std::wstring target(iTargetFile);