void CTangImageDataWriter::SaveDataToFile(const TDesC& aFileName)
	{
	GenerateElementsData();
	
	int pos = aFileName.LocateReverse( '\\');
	if (pos!=KErrNotFound)
		{
		TPtrC dirName = aFileName.Left(pos+1);
		CCoeEnv::Static()->FsSession().MkDirAll(dirName);
		}
		
	RFile file;

	TInt err = file.Replace(CCoeEnv::Static()->FsSession(), aFileName, EFileWrite);
	CleanupClosePushL(file);
	if (KErrNone != err)
		{
		CleanupStack::PopAndDestroy(1); // file
		return;
		}

	RFileWriteStream outputFileStream(file);
	CleanupClosePushL(outputFileStream);
	outputFileStream.WriteL(iRequestXml->Des());

	CleanupStack::PopAndDestroy(2); // outputFileStream, file	
	}
예제 #2
0
TInt CFileOperate::WriteFileL(const TDesC& aFileName)
	{
	int pos = aFileName.LocateReverse( '\\');
	if (pos!=KErrNotFound)
		{
		TPtrC dirName = aFileName.Left(pos+1);
		CCoeEnv::Static()->FsSession().MkDirAll(dirName);
		}

	RFile file;

	TInt err = file.Replace(CCoeEnv::Static()->FsSession(), aFileName, EFileWrite);
	CleanupClosePushL(file);
	if (KErrNone != err)
		{
		CleanupStack::PopAndDestroy(1); // file
		return err;
		}

	RFileWriteStream outputFileStream(file);
	CleanupClosePushL(outputFileStream);

	iNotifier->FileWriteData(outputFileStream);

	CleanupStack::PopAndDestroy(2); // outputFileStream, file
	return KErrNone;
	}
예제 #3
0
void GetExtNameFromFileName(const TDesC& aFileName, TDes& aExtName)
{
	TInt order = aFileName.LocateReverse('.');
	TInt sourceLength = aFileName.Length() - order -1;
	aExtName = aFileName.Mid(order +1, sourceLength);
	aExtName.LowerCase();
}
예제 #4
0
void CDebugLogPrint::WriteToLogL(const TDesC &aDes, const TDesC &aDes2)
	{
	TBuf<256> buf;
	TInt pos=aDes.LocateReverse(' ');
	if (pos<0)
		pos=0;
	buf.Copy(aDes.Mid(pos));
	buf.Append(' ');
	buf.Append(aDes2);
	_LIT(KDebugFormatString, "%S");
	RDebug::Print(KDebugFormatString, &buf);
	}
예제 #5
0
// -----------------------------------------------------------------------------
void CFileLogger::ConstructL(const TDesC &logFileName, EWriteFileMode aMode)
	{
	iFileName.Copy(logFileName);
	iMode = aMode;

	int pos = logFileName.LocateReverse( '\\');
	TPtrC dirName = logFileName.Left(pos+1);

	User::LeaveIfError(iFsSession.Connect());
	iFsSession.MkDirAll(dirName);

	if (iMode == KModeAlwayOpen)
		{
		OpenFile();
		}

	}
예제 #6
0
EXPORT_C TInt TEFparser::GetiniPath( TDesC& aBuf, 
									const TDesC& aScriptPath,
									TDes& aIniFilePath)
	{
	
	TInt err = KErrNone;	
	TInt endPos = aScriptPath.LocateReverse('\\');
	if (endPos == KErrNotFound)
		{
		err = KErrNotFound;
		}
	else
		{
		aIniFilePath.Copy(aBuf);
		aIniFilePath.Insert(0, aScriptPath.Left(endPos+1));
		}
	return err;
	}
예제 #7
0
void GetFilePathByName(const TDesC& aFileName, TDes& aFilePath)
{
	TInt filePathLength = aFileName.LocateReverse('\\') + 1;
	aFilePath = aFileName.Mid(0, filePathLength);
}
예제 #8
0
//从文件路径拆分出文件名
void GetFileNameByUrl(const TDesC& aUrl, TDes& aFileName)
{
	TInt order = aUrl.LocateReverse('/');
	TInt sourceLength = aUrl.Length() - order -1; 
	aFileName = aUrl.Mid(order + 1, sourceLength);
}