secureswitools/swisistools/source/interpretsislib/adornedutilities.cpp
branchRCL_3
changeset 24 5cc91383ab1e
parent 0 ba25891c3a9e
equal deleted inserted replaced
23:cd189dac02f7 24:5cc91383ab1e
     1 /*
     1 /*
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2008-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".
    54 			}
    54 			}
    55 		}
    55 		}
    56 	}
    56 	}
    57 }
    57 }
    58 
    58 
       
    59 #ifndef __TOOLS2_LINUX__
    59 bool IsAdornedVariationOf(const std::wstring& aFileName1, const std::wstring& aFileName2)
    60 bool IsAdornedVariationOf(const std::wstring& aFileName1, const std::wstring& aFileName2)
       
    61 #else
       
    62 bool IsAdornedVariationOf(const std::wstring& aFileName1, const std::wstring& aFileName2, const std::wstring& aDrivePath)
       
    63 #endif
    60 {
    64 {
    61 	std::wstring unadornedFileName1;
    65 	std::wstring unadornedFileName1;
    62 	GetUnadornedFileName(aFileName1,unadornedFileName1);
    66 	GetUnadornedFileName(aFileName1,unadornedFileName1);
    63 
    67 
    64 	std::wstring unadornedFileName2;
    68 	std::wstring unadornedFileName2;
    65 	GetUnadornedFileName(aFileName2,unadornedFileName2);
    69 	GetUnadornedFileName(aFileName2,unadornedFileName2);
       
    70 
       
    71 	#ifdef __TOOLS2_LINUX__
       
    72 	ConvertToLocalPath( unadornedFileName1, aDrivePath );
       
    73 	ConvertToLocalPath( unadornedFileName2, aDrivePath );
       
    74 	#endif
    66 
    75 
    67   	// Check whether filename2 is a variant of filename1
    76   	// Check whether filename2 is a variant of filename1
    68   	// e.g: d:\sys\bin\DummyDll{000A0001}.dll is considered a variant of c:\sys\bin\DummyDll.dll 
    77   	// e.g: d:\sys\bin\DummyDll{000A0001}.dll is considered a variant of c:\sys\bin\DummyDll.dll 
    69   	// because they both break down to \sys\bin\DummyDll.dll
    78   	// because they both break down to \sys\bin\DummyDll.dll
    70 	std::wstring fileName1Path(StringUtils::Path(unadornedFileName1));
    79 	std::wstring fileName1Path(StringUtils::Path(unadornedFileName1));
    71 	std::wstring fileName1NameAndExt(StringUtils::NameAndExt(unadornedFileName1));
    80 	std::wstring fileName1NameAndExt(StringUtils::NameAndExt(unadornedFileName1));
    72 
    81 
    73 	std::wstring fileName2Path(StringUtils::Path(unadornedFileName2));
    82 	std::wstring fileName2Path(StringUtils::Path(unadornedFileName2));
    74 	std::wstring fileName2NameAndExt(StringUtils::NameAndExt(unadornedFileName2));
    83 	std::wstring fileName2NameAndExt(StringUtils::NameAndExt(unadornedFileName2));
    75 
    84 
    76 	return ((fileName1Path == fileName2Path) && (fileName1NameAndExt == fileName2NameAndExt));
    85 	return ( !wcscmp(fileName1Path.c_str(), fileName2Path.c_str()) && !wcscmp(fileName1NameAndExt.c_str(), fileName2NameAndExt.c_str()) );
    77 }
    86 }
    78 	
    87 	
    79 void FindAllAdornedVariants(const std::wstring& aSearchNameWild, const std::wstring& aSearchPath, std::list<std::wstring>& aAdornedFileNamesFound, const DrivesMap& aDriveMap)
    88 void FindAllAdornedVariants(const std::wstring& aSearchNameWild, const std::wstring& aSearchPath, std::list<std::wstring>& aAdornedFileNamesFound, const DrivesMap& aDriveMap)
    80 {
    89 {
    81 	DrivesMap::const_iterator it = aDriveMap.begin();
    90 	DrivesMap::const_iterator it = aDriveMap.begin();