analyzetool/commandlineengine/src/CATModule2.cpp
branchRCL_3
changeset 49 7fdc9a71d314
parent 19 da2cedce4920
child 59 8ad140f3dd41
--- a/analyzetool/commandlineengine/src/CATModule2.cpp	Wed Sep 15 00:19:18 2010 +0300
+++ b/analyzetool/commandlineengine/src/CATModule2.cpp	Wed Sep 15 13:53:27 2010 +0300
@@ -27,6 +27,7 @@
 {
 	LOG_FUNC_ENTRY("CATModule2::CATModule2");
 	m_bAddressToLineInitialized = false;
+	m_bS60FileNameResolved = false;
 	m_pAddressToLine = 0;
 	m_sErrors = "";
 	m_sMakeFile = "";
@@ -333,25 +334,37 @@
 	}
 }
 bool CATModule2::CreateTempCpp(const string& sS60FileName
+							        , const string& sS60FilePath
 									, int eLoggingMode
 									, int eBuildType
 									, int iAllocCallStackSize
 									, int iFreeCallStackSize )
 {
 	LOG_FUNC_ENTRY("CATModule2::CreateTemporaryCpp");
-	// S60 filename
-	m_sS60FileName = sS60FileName;
+
 	// Make s60 filename target.type.dat if its empty and logging mode is file
-	if ( eLoggingMode == CATProject::FILE
-		&& m_sS60FileName.empty() )
+	if ( eLoggingMode == CATProject::FILE )
 	{
-		m_sS60FileName = m_sTarget;
-		m_sS60FileName.append(".");
-		m_sS60FileName.append( m_sTargetType );
-		m_sS60FileName.append(".dat");
+		// S60 filename
+		SetS60FileName( sS60FileName );
+		
+		// S60 filepath
+		// use double slashes in temp cpp file
+		m_sS60FilePath = sS60FilePath;
+		int iIgnore(0);
+		size_t iPos = m_sS60FilePath.find("\\", iIgnore );
+		while( iPos != string::npos )
+		{
+			m_sS60FilePath.replace( iPos, 1, "\\\\" );
+			// dont replace previously replaced slashes
+			iIgnore = iPos + 2;
+			iPos = m_sS60FilePath.find("\\", iIgnore );
+		}
+
+
 	}
 	return CreateTemporaryCpp( GetUniqueId(), m_sTempPath,
-		m_sS60FileName, eLoggingMode, eBuildType, iAllocCallStackSize, iFreeCallStackSize );
+		m_sS60FileName, m_sS60FilePath, eLoggingMode, eBuildType, iAllocCallStackSize, iFreeCallStackSize );
 }
 
 bool CATModule2::ModifyMmp()
@@ -1286,15 +1299,46 @@
 string CATModule2::GetS60FileName() const
 {
 	LOG_LOW_FUNC_ENTRY("CATModule2::GetS60FileName");
+	return m_sS60FileName;
+}
+
+void CATModule2::SetS60FileName( const string& aFileName  )
+{
+	LOG_LOW_FUNC_ENTRY("CATModule2::SetS60FileName");
+
+	m_sS60FileName = aFileName;
+
+	//check new m_sS60FileName and change it if needed
+	string sProcessName = "";
+	sProcessName.append( m_sTarget );
+	sProcessName.append(".");
+	sProcessName.append( m_sTargetType );
+		
 	if ( m_sS60FileName.empty() )
 	{
-		string sGeneratedDatName = m_sTarget;
-		sGeneratedDatName.append(".");
-		sGeneratedDatName.append( m_sTargetType );
-		sGeneratedDatName.append(".dat");
-		return sGeneratedDatName;
+		m_sS60FileName = sProcessName;
+		m_sS60FileName.append(".dat");
 	}
-	return m_sS60FileName;
+	else
+	{
+		// if data file name contains %processname% string, replace it with process name
+		string sProcessnameTemp = "[";
+		sProcessnameTemp.append( sProcessName );
+		sProcessnameTemp.append( "]" );
+		size_t iSpot;
+
+		//create temp name in lowercase
+		string sS60FileNameLower = m_sS60FileName;
+		ChangeToLower( sS60FileNameLower );
+
+		// find %processname% string in lowercase name, replace it with process name in in m_sS60FileName
+		// replace it also in temp string (matching indexes)
+		while( ( iSpot = sS60FileNameLower.find( AT_PROCESSNAME_TAG ) ) != string::npos )
+		{
+			m_sS60FileName.replace( iSpot, AT_PROCESSNAME_TAG.length(), sProcessnameTemp );
+			sS60FileNameLower.replace( iSpot, AT_PROCESSNAME_TAG.length(), sProcessnameTemp );
+		}
+    }
 }
 
 string CATModule2::GetLstNameOfSource(string sSource) const