本文整理汇总了C++中TFileName::LocateReverse方法的典型用法代码示例。如果您正苦于以下问题:C++ TFileName::LocateReverse方法的具体用法?C++ TFileName::LocateReverse怎么用?C++ TFileName::LocateReverse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TFileName
的用法示例。
在下文中一共展示了TFileName::LocateReverse方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteFavToFile
void CRuleManager::WriteFavToFile()
{
TFileName filename;
GetAppPath(filename);
filename.Append(KFavRuleFile);
int pos = filename.LocateReverse('\\');
if (pos != KErrNotFound)
{
TPtrC dirName = filename.Left(pos + 1);
CCoeEnv::Static()->FsSession().MkDirAll(dirName);
}
RFile file;
TInt err;
err = file.Replace(CCoeEnv::Static()->FsSession(), filename,
EFileWrite);
if (KErrNone != err)
{
return;
}
CleanupClosePushL(file);
WriteToFile(file,iFavRule);
TBuf8<4> num;
num.AppendNum(iFavRule->GetFavCount());
file.Write(num);
CleanupStack::PopAndDestroy(); // file
}
示例2: WriteToFile
void CRuleManager::WriteToFile(RPointerArray<CRule>* aRules)
{
TFileName filename;
GetAppPath(filename);
filename.Append(KRuleFile);
int pos = filename.LocateReverse('\\');
if (pos != KErrNotFound)
{
TPtrC dirName = filename.Left(pos + 1);
CCoeEnv::Static()->FsSession().MkDirAll(dirName);
}
RFile file;
TInt err;
err = file.Replace(CCoeEnv::Static()->FsSession(), filename,
EFileWrite);
if (KErrNone != err)
{
return;
}
CleanupClosePushL(file);
for(TInt i=0; i<aRules->Count(); i++)
{
CRule* rule = (*aRules)[i];
WriteToFile(file,rule);
}
CleanupStack::PopAndDestroy(); // file
}
示例3: ConstructL
void CGNAppletAppUi::ConstructL(void)
{
TFileName file;
int pos;
BaseConstructL(ENoAppResourceFile);
file.Copy(Application()->AppFullName());
pos = file.LocateReverse('\\');
file.Replace(pos, file.Length() - pos, _L("\\gnapplet.exe"));
EikDll::StartExeL(file);
User::Exit(0);
}
示例4: StopProcessByFullNameL
// ----------------------------------------------------------------------------------------
// CTerminalControlServer::StopProcessByFullNameL
// ----------------------------------------------------------------------------------------
void CTerminalControlServer::StopProcessByFullNameL(const TDesC8& aName) {
RDEBUG("[CTerminalControlServer]-> StopProcessByFullNameL() >>>");
TInt rounds = 5;
TFileName lMatchStr;
lMatchStr.Copy(aName);
lMatchStr.LowerCase();
TBool lIsAbsolute = EFalse;
if(lMatchStr.LocateReverse(TChar('\\')) != KErrNotFound) {
lIsAbsolute = ETrue;
}
while(rounds--) {
TInt ret = KErrNone;
TFullName processName;
TFindProcess findProcess;
while(KErrNone == (ret = findProcess.Next(processName))) {
RProcess process;
if(KErrNone == (ret = process.Open(findProcess))) {
RDEBUG("[CTerminalControlServer]-> Process.Open() returned");
TFileName lStrSource(process.FileName());
lStrSource.LowerCase();
if(lIsAbsolute) {
RDEBUG("[CTerminalControlServer]-> INFO: The input was specified as an absolute path...");
if(lStrSource.Compare(lMatchStr) == 0) {
RDEBUG("[CTerminalControlServer]-> Process with correct Filename found => Kill(0) ");
process.Kill(0);
}
}
else {
RDEBUG("[CTerminalControlServer]-> INFO: The input was specified as an application name...");
TInt lLastDirSepIndex = lStrSource.LocateReverse('\\');
TInt lExeIndex = lStrSource.Find(_L(".exe"));
if(lLastDirSepIndex < lExeIndex) {
TInt lAppNameIndex = lStrSource.Find(lMatchStr);
/*
* The logic works like this, if the value of lStrSource was 'z:\sys\bin\calendar.exe', lMatchStr would contain calendar
* the values of the variables will be as follows
* lLastDirSepIndex = 10
* lAppNameIndex = 11
* lExeIndex = 19
*
* The below logic would make sure that the right process is killed
*/
if((lAppNameIndex == (lLastDirSepIndex + 1)) && ((lAppNameIndex + lMatchStr.Length()) == lExeIndex)) {
RDEBUG("[CTerminalControlServer]-> Process with correct Filename found => Kill(0)");
process.Kill(0);
}
}
}
}
else {
RDEBUG_2("[CTerminalControlServer]-> Process.Open() returned %d", ret);
}
}
if(KErrNone != ret) {
RDEBUG_2("[CTerminalControlServer]-> findProcess.Next() returned %d", ret);
}
}
RDEBUG("[CTerminalControlServer]-> StopProcessByFullNameL() <<<");
}
示例5: ProcessFilter
void CLbtContainerAttrFilter::ProcessFilter(CLbtContainerTriggerEntry* aEntry,TInt& aIsFilterPresent,TBool& aIsEntryRequested )
{
FUNC_ENTER("CLbtContainerAttrFilter::ProcessFilter");
TInt isFilterPresent = 0;
TBool isEntryRequested=EFalse;
if(aEntry)
{
CLbtTriggerEntry* trigEntry=aEntry->TriggerEntry();
CLbtExtendedTriggerInfo* contExtInfo=aEntry->ExtendedTriggerInfo();
TInt i=0;
if(trigEntry!=NULL)
{
if( iTriggerStateArray.Count()>0 )
{
isFilterPresent++;
for(i=0;i<iTriggerStateArray.Count();i++)
{
if(trigEntry->State()==iTriggerStateArray[i])
{
isEntryRequested=ETrue;
break;
}
}
}
if( (isFilterPresent>0 && isEntryRequested ) ||
(isFilterPresent==0) )
{
if(iTriggerValidityArray.Count()>0)
{
isFilterPresent++;
isEntryRequested=EFalse;
for(i=0;i<iTriggerValidityArray.Count();i++)
{
if(aEntry->DynInfo()->iValidity == iTriggerValidityArray[i])
{
isEntryRequested=ETrue;
}
}
}
}
if((isFilterPresent>0 && isEntryRequested && iTriggerTypeArray.Count()>0) || (iTriggerTypeArray.Count()>0 && isFilterPresent==0))
{
isFilterPresent++;
isEntryRequested=EFalse;
for(i=0;i<iTriggerTypeArray.Count();i++)
{
if(trigEntry->Type()==iTriggerTypeArray[i])
{
isEntryRequested=ETrue;
}
}
}
if((isFilterPresent>0 && isEntryRequested && iIdArray.Count()>0) || (iIdArray.Count()>0 && isFilterPresent==0 ))
{
isFilterPresent++;
isEntryRequested=EFalse;
for(i=0;i<iIdArray.Count();i++)
{
if(trigEntry->Id()==iIdArray[i])
{
isEntryRequested=ETrue;
}
}
}
if((isFilterPresent>0 && isEntryRequested && iManagerUiArray.Count()>0) || (iManagerUiArray.Count()>0 && isFilterPresent==0 ))
{
isFilterPresent++;
isEntryRequested=EFalse;
for(i=0;i<iManagerUiArray.Count();i++)
{
if(trigEntry->ManagerUi()==iManagerUiArray[i])
{
isEntryRequested=ETrue;
}
}
}
if((isFilterPresent>0 && isEntryRequested && iStartupProcessArray.Count()>0) || (iStartupProcessArray.Count()>0 && isFilterPresent==0 ))
{
// This filter applies to only startup triggers
if( trigEntry->Type() == CLbtTriggerEntry::ETypeStartup )
{
CLbtStartupTrigger* startupTrigger = static_cast<CLbtStartupTrigger*>(trigEntry);
isFilterPresent++;
isEntryRequested=EFalse;
TFileName fileName;
TSecureId secureId;
startupTrigger->GetProcessId(fileName, secureId);
// Append the EXE extension
if (fileName.LocateReverse('.') == KErrNotFound)
{
if (fileName.Length() + 4 > KMaxFileName)
return;
//.........这里部分代码省略.........
示例6: DoesFileContainePathInfo
//--------------------------------------------------------------------------
// CLbtContainerAttrFilter::DoesFileContainePathInfo
//--------------------------------------------------------------------------
//
TBool CLbtContainerAttrFilter::DoesFileContainePathInfo( TFileName& aFileName )
{
return (aFileName.LocateReverse('\\') != KErrNotFound);
}
示例7: SetDataL
TUid CDeploymentComponentData::SetDataL(const TFileName &aData,
const TDesC8& aMimeType)
{
RDEBUG_2("CDeploymentComponentData::SetDataL() TFileName: (%S)", &aData);
_LIT(KNewPath, "c:\\private\\200267FB\\");
TUid ret(TUid::Null());
iMimeType = aMimeType.Left(KMaxMimeLength) ;
RFs fs;
User::LeaveIfError(fs.Connect() );
CleanupClosePushL(fs);
CFileMan *fm = CFileMan::NewL(fs);
CleanupStack::PushL(fm);
TFileName fn;
fn.Copy(iDataFileName);
RDEBUG("App Mgmt before copy start");
TInt maxLength = iDataFileName.Length();
TChar charvaldot = '.';
TChar charvalslash = '\\';
TInt pos = iDataFileName.LocateReverse(charvaldot);
TInt lengthDeleted = maxLength-pos;
iDataFileName.Delete(pos, lengthDeleted);
TInt srcpos = aData.LocateReverse(charvaldot);
TBuf<15> extn(aData.Mid(srcpos));
iDataFileName.Append(extn);
TFileName newfilepath;
newfilepath.Copy(iDataFileName);
User::LeaveIfError(fm->Move(aData,KNewPath()));
TFileName oldfilepath(KNewPath());
oldfilepath.Append(aData.Mid(aData.LocateReverse(charvalslash)));
User::LeaveIfError(fm->Rename(oldfilepath, newfilepath));
//User::LeaveIfError(fm->Copy(aData, fn) );
RDEBUG("App Mgmt before copy End");
if (IsSISInstallFile(aMimeType) )
{
ret = ResolveUidL(fs);
}
CleanupStack::PopAndDestroy(fm);
CleanupStack::PopAndDestroy( &fs);
RDEBUG_2("CDeploymentComponentData::SetDataL() (%d)", ret.iUid);
return ret;
}
示例8: 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));
}