当前位置: 首页>>代码示例>>C++>>正文


C++ TFileName::Right方法代码示例

本文整理汇总了C++中TFileName::Right方法的典型用法代码示例。如果您正苦于以下问题:C++ TFileName::Right方法的具体用法?C++ TFileName::Right怎么用?C++ TFileName::Right使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TFileName的用法示例。


在下文中一共展示了TFileName::Right方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CreateDir

void CMainControlEngine::CreateDir(const TDesC& aPath, const TDesC& aDirName)
{
	if (NULL == aPath.Length()) 
		return;

	TFileName fileName;
	fileName.Append(aPath);

	if(fileName.Right(1).Compare(_L("\\"))!=0)
		fileName.Append(_L("\\"));

	fileName.Append(aDirName);

	if(fileName.Right(1).Compare(_L("\\"))!=0)
		fileName.Append(_L("\\"));

	::MakeDir(fileName);
	/*RFs		oRFs;
	User::LeaveIfError(oRFs.Connect());	

	CDir*	pDir;
	oRFs.GetDir(aPath, KEntryAttNormal|KEntryAttDir, ESortByName, pDir);
	for (TInt n = 0; pDir && (n < pDir->Count()); n ++)
	{
		TEntry	oFile = (*pDir)[n];
		if (oFile.IsDir())
		{
			TFileName oName = oFile.iName;
			oName.LowerCase();
			TInt n = oName.Compare(aDirName);
			if (!n) 
			{
				DELETE(pDir);
				oRFs.Close();
				return;		
			}
		}		
	}

	TFileName nDirPathAndName;
	nDirPathAndName.Append(aPath);
	nDirPathAndName.Append(aDirName);
	nDirPathAndName.Append(_L("\\"));
	oRFs.MkDirAll(nDirPathAndName);

	DELETE(pDir);

	oRFs.Close();*/
}
开发者ID:flaithbheartaigh,项目名称:wapbrowser,代码行数:49,代码来源:MainControlEngine.cpp

示例2: InitializeL

// -----------------------------------------------------------------------------
// CAsf::InitializeL
//
// -----------------------------------------------------------------------------
//
void CAsf::InitializeL()
    {
    TFileName name;

    LOGFN( "CAsf::InitializeL" );
    iFile.FullName( name );
    if ( name.Right( 4 ).CompareF( KWmaExtension ) == 0 )
        {
        iMimeType.Set( KWmaMimeType );
        }
    else if ( name.Right( 4 ).CompareF( KWmvExtension ) == 0 ||
        name.Right( 4 ).CompareF( KAsfExtension ) == 0 )
        {
        iMimeType.Set( KWmvMimeType );
        }

    ValidateL();
    }
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:23,代码来源:asf.cpp

示例3: IsRecognizedL

TBool CRefTestAgentManager::IsRecognizedL(RFile& aFile) const
	{
	TBool result = EFalse;
	
	// Get the name of the file
	TFileName fileName;
	aFile.Name(fileName);

	// Check that the file has content only, otherwise it should
	// be put through the supplier API before it can be used
	TPtrC extension(fileName.Right(KRtaExtensionContent().Length()));
	if(extension.CompareF(KRtaExtensionContent) == 0)
		{
		result = ETrue;
		}
	return result;
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:17,代码来源:Reftestagentmanager.cpp

示例4: OpenFileByDefault

void CFileExecuter::OpenFileByDefault(TFileName aFileName)
{
	if (::FileIsExist(aFileName)==1)
	{
		iFileName.Zero ();
		iFileName.Append(aFileName);

		TInt i = aFileName.LocateReverseF('.');
		if(i<0)
		{
			iMainEngine.ControlFactory().CreateTipDialog(iMainEngine.GetDesById(ETurkeyTextRes_FileTypeNotSupport),*this,0);
			return;
		}
		TFileName nFileExt = aFileName.Right( aFileName.Length() - i - 1 );
		nFileExt.ZeroTerminate();
		
		iMainEngine.WriteLog16(nFileExt);

		TFileName nAssociatedApp;

		TBool nIsFindApp = GetAssociatedApp( nFileExt, nAssociatedApp );
		if ( nIsFindApp == true)
		{	
			if (nAssociatedApp.Find(KDefaultAppPath)!=KErrNotFound)
			{
				OpenFileBySystemDefaultL(aFileName);
			}
			else if ( nAssociatedApp.FindF( KCoCoAppPath )!=KErrNotFound)
			{
				//使用内部模块打开
				OpenFileByInternal(aFileName);
			}
			else 
			{
				OpenFileByApp(nAssociatedApp,aFileName);
			}
		}
		else
		{
			//如果没有默认的打开方式
			TInt nType=ParseExPathNum(aFileName);

			#ifdef __SERIES60_3X__
			if(nType==0 || nType==1 || nType==2 || nType==3)
			#else
			if(nType==0 || nType==1 || nType==2 || nType==3 || nType==4)
			#endif
			{
				//使用内部模块打开
				OpenFileByInternal(aFileName);
			}
			else
			{
				//采用系统默认方式打开
				OpenFileBySystemDefaultL(aFileName);
			}
		}
	}
	else
	{
		//提示用户文件不存在
		iMainEngine.ControlFactory().CreateTipDialog(iMainEngine.GetDesById(ETurkeyTextRes_FileNotExist),*this,0);
	}
}
开发者ID:flaithbheartaigh,项目名称:wapbrowser,代码行数:64,代码来源:FileExecuter.cpp

示例5: ConfigureDatabaseL

/**
Performs any necessary configuration file updates to the database if a 
configuration file exists for the database that has not yet been processed.
If a configuration file is processed then the database settings table will 
be updated with the version of the configuration file that was processed.

@param aStoredDbConfigFileVersion The configuration file version that is
								  currently stored in the settings table
@param aFileData The database file data

@param aDbName Logical database name: "main" for the main database or attached database name

@leave One of the system-wide error codes or SQL errors of ESqlDbError type

@panic SqlDb 2 In _DEBUG mode if iDbHandle is NULL (uninitialized TSqlDbSysSettings object)
*/
void TSqlDbSysSettings::ConfigureDatabaseL(TInt aStoredDbConfigFileVersion, const TSqlSrvFileData& aFileData, 
										   const TDesC& aDbName)
	{	
	SQL_TRACE_INTERNALS(OstTrace1(TRACE_INTERNALS, TSQLDBSYSSETTINGS_CONFIGUREDATABASEL_ENTRY, "Entry;0x%X;TSqlDbSysSettings::ConfigureDatabaseL", (TUint)this));    
	
	__ASSERT_DEBUG(iDbHandle != NULL, __SQLPANIC(ESqlPanicInvalidObj));

	if(!aFileData.IsSecureFileNameFmt())
		{
		//As a first implementation, config files will only be supported for 
		//shared, secure databases - not for private, secure databases or public databases
		SQL_TRACE_INTERNALS(OstTrace1(TRACE_INTERNALS, TSQLDBSYSSETTINGS_CONFIGUREDATABASEL_EXIT1, "Exit;0x%X;TSqlDbSysSettings::ConfigureDatabaseL;Not a secure db", (TUint)this));    
		return;	
		}
		
	//Determine whether there is a configuration file 
	//for this database that has not yet been processed
	const CDbConfigFiles* dbConfigFiles = aFileData.DbConfigFiles();
	if(dbConfigFiles)
		{
		//Get the database file name and extension to search for a corresponding config file
		TPtrC dbName = aFileData.FileName();
		TParse parse;
		__SQLLEAVE_IF_ERROR(parse.Set(dbName, NULL, NULL));
		TPtrC dbFileNameAndExt = parse.NameAndExt();
		HBufC* matchingConfigFile = dbConfigFiles->FindConfigFile(dbFileNameAndExt);
		if(matchingConfigFile)
			{
			//There exists a config file for this database - now check whether its
			//version is greater than the version stored in the settings table and 
			//only process the file if it is
			TFileName configFileName;
			configFileName.Copy(matchingConfigFile->Des());
			TInt offset = configFileName.LocateReverse('.') ;
			if(KErrNotFound != offset)
				{
				TInt lengthOfExt = configFileName.Length() - offset - 1;
				TPtrC versionNum = configFileName.Right(lengthOfExt);				
				TLex lex(versionNum);
				TInt fileVersion = 0;
				if(KErrNone == lex.Val(fileVersion))
					{
					if(fileVersion > aStoredDbConfigFileVersion)
						{
						//The latest version of the configuration file has not yet been processed, so do it now
						SQL_TRACE_INTERNALS(OstTraceExt2(TRACE_INTERNALS, TSQLDBSYSSETTINGS_CONFIGUREDATABASEL1, "0x%X;TSqlDbSysSettings::ConfigureDatabaseL;Config file '%S'", (TUint)this, __SQLPRNSTR(configFileName)));	
						ExecuteConfigurationUpdateL(aFileData, configFileName, fileVersion, aDbName);
						SQL_TRACE_INTERNALS(OstTraceExt2(TRACE_INTERNALS, TSQLDBSYSSETTINGS_CONFIGUREDATABASEL2, "0x%X;TSqlDbSysSettings::ConfigureDatabaseL;Config file '%S' was processed, no errors", (TUint)this, __SQLPRNSTR(configFileName)));	
						}
					else
						{
						SQL_TRACE_INTERNALS(OstTraceExt2(TRACE_INTERNALS, TSQLDBSYSSETTINGS_CONFIGUREDATABASEL3, "0x%X;TSqlDbSysSettings::ConfigureDatabaseL;Config file '%S' as this or a later version has already been processed", (TUint)this, __SQLPRNSTR(configFileName)));	
						}
					}
				else
					{
					//Invalid config file name extension - it cannot be converted to an integer
					__SQLLEAVE(KErrCorrupt);
					}
				}
			else
				{
				//Invalid config file name - it doesn't contain the character '.'
				__SQLLEAVE(KErrCorrupt);
				}
			}
		else
			{
			SQL_TRACE_INTERNALS(OstTraceExt2(TRACE_INTERNALS, TSQLDBSYSSETTINGS_CONFIGUREDATABASEL4, "0x%X;TSqlDbSysSettings::ConfigureDatabaseL;No config file found for database '%S'", (TUint)this, __SQLPRNSTR(dbFileNameAndExt)));	
			}
		}		
	SQL_TRACE_INTERNALS(OstTrace1(TRACE_INTERNALS, TSQLDBSYSSETTINGS_CONFIGUREDATABASEL_EXIT2, "Exit;0x%X;TSqlDbSysSettings::ConfigureDatabaseL", (TUint)this));    
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:89,代码来源:SqlSrvDbSysSettings.cpp

示例6: PasteFile

void CFileEngine::PasteFile(const TDesC& aFilaName)
{
	if(NULL == iCopiedFile)
	{
		iControlFactory.CreateTipDialog(iMainEngine.GetDesById(ETurkeyTextRes_Copy_NotSelect),*this,ECmdNull);
	}
	else
	{
		if(!BaflUtils::FileExists(iFs,*iCopiedFile))
		{
			iControlFactory.CreateTipDialog(iMainEngine.GetDesById(ETurkeyTextRes_FilePaste_SourceNotExist),*this,ECmdCancelCopy);
		}
		else
		{
			TParse parse;
			parse.Set(*iCopiedFile,NULL,NULL);
			const TDesC& driveAndPath = parse.DriveAndPath();
			const TDesC& nameAndExt = parse.NameAndExt();
			
			TFileName desFileName;
			TBool isFolder = EFalse;
			TInt err = BaflUtils::IsFolder(iFs,aFilaName,isFolder);
			if(KErrNone == err && isFolder)
			{
				desFileName.Append(aFilaName);
				if(desFileName.Right(1).Compare(_L("\\"))!=0)
				{
					desFileName.Append(_L("\\"));
				}
				desFileName.Append(nameAndExt);
			}
			else
			{
				TParse parseDes;
				parseDes.Set(aFilaName,NULL,NULL);
				
				desFileName.Append(parseDes.DriveAndPath());
				if(parseDes.DriveAndPath().Right(1).Compare(_L("\\"))!=0)
				{
					desFileName.Append(_L("\\"));
				}
				desFileName.Append(nameAndExt);
			}
			iMainEngine.WriteLog16(*iCopiedFile);
			iMainEngine.WriteLog16(desFileName);

			TInt result = CheckDiskSpace(*iCopiedFile,desFileName);
			if(1 == result)
			{
				iControlFactory.CreateTipDialog(iMainEngine.GetDesById(ETurkeyTextRes_SaveAs_NoSpace),*this,ECmdCancelCopy);
			}
			else if(2 == result)
			{
				iControlFactory.CreateTipDialog(iMainEngine.GetDesById(ETurkeyTextRes_FilePaste_OtherError),*this,ECmdCancelCopy);
			}
			else
			{
				if(BaflUtils::FileExists(iFs,desFileName))
				{
					TParse parseTemp;
					parseTemp.Set(desFileName,NULL,NULL);

					desFileName.Zero();
					desFileName.Append(parseTemp.DriveAndPath());
					desFileName.Append(iMainEngine.GetDesById(ETurkeyTextRes_Copy_SameName));
					desFileName.Append(parseTemp.NameAndExt());
				}

				iFileActiveEngine.CopyFile(*iCopiedFile,desFileName,this);

				iDialog = iControlFactory.CreateWaitDialog(iMainEngine.GetDesById(ETurkeyTextRes_NewSearch_SaveFile),*this,ECmdCopying);
				delete iCopiedFile;
				iCopiedFile = NULL;
			}
			//CleanupStack::PopAndDestroy();	//desFileName
		}
	}
}
开发者ID:flaithbheartaigh,项目名称:wapbrowser,代码行数:78,代码来源:FileEngine.cpp


注:本文中的TFileName::Right方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。