本文整理汇总了C++中TParse::DriveAndPath方法的典型用法代码示例。如果您正苦于以下问题:C++ TParse::DriveAndPath方法的具体用法?C++ TParse::DriveAndPath怎么用?C++ TParse::DriveAndPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TParse
的用法示例。
在下文中一共展示了TParse::DriveAndPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetFolderL
void CAknFileSettingPage::SetFolderL(const TDesC& aFolder)
{
TParse parse;
TFileName file;
TDesC* pos=NULL;
parse.SetNoWild(iFileValue,NULL,NULL);
if(aFolder.CompareF(KFolderUp)==0)
{
if(iFileValue.Length())
{
if(parse.PopDir()==KErrNone)
{
TParse parse2;
parse2.SetNoWild(iFileValue,NULL,NULL);
TPtrC ptr=parse2.DriveAndPath();
file=ptr.Left(ptr.Length()-1);
parse2.SetNoWild(file,NULL,NULL);
file=parse2.NameAndExt();
pos=&file;
iFileValue=parse.DriveAndPath();
}
else
iFileValue.Zero();
}
}
else
{
iFileValue=parse.DriveAndPath();
iFileValue.Append(aFolder);
iFileValue.Append('\\');
}
ReadFilesL(pos);
}
示例2:
void CTap2MenuAppUi::ReadExceptions()
{
TInt err=KErrNone;
iExceptions.Reset();
if (BaflUtils::FileExists(CEikonEnv::Static()->FsSession(),KExceptionsPath)) //!!!!!!!!!!!!!!!!!!!!!!!!!!!
{
TBuf<255> val;
TLex conv;
TUint32 IntVal;
RFile filesave;
TBuf<255> t;
TFileText ft;
filesave.Open(CEikonEnv::Static()->FsSession(), KExceptionsPath, EFileRead);
ft.Set(filesave);
while (ft.Read(val)==KErrNone)
{
conv.Assign(val);
conv.Val(IntVal,EHex);
iExceptions.AppendL(TUid::Uid(IntVal));
}
filesave.Close();
}
else
{
TParse parse;
CEikonEnv::Static()->FsSession().Parse(KExceptionsPath,parse);
if (!BaflUtils::FolderExists(CEikonEnv::Static()->FsSession(),parse.DriveAndPath()))
{
CEikonEnv::Static()->FsSession().MkDirAll(parse.DriveAndPath());
}
}
}
示例3: AddPrinterDriverDirL
EXPORT_C void CPrintSetup::AddPrinterDriverDirL(const TDesC& aDriverDir)
/** Adds a search path for printer drivers.
This function must be called before a model name list can be created. It can
be called repeatedly to add a number of paths to the search list.
When a printer model name list is requested (using ModelNameListL()), the
directories specified in each of the search paths are scanned on all non-remote
drives for .pdr files, indicating the models supported. If any path contains
a drive, that drive alone is searched.
@param aDriverDir Path which specifies a directory in which to search for
printer drivers. Any filename in the path is ignored. If the path is already
in the list, it is not added again.
@leave KErrNoMemory There is insufficient memory to perform the operation. */
{
TParse parser;
parser.Set(aDriverDir,NULL,NULL);
for (TInt i=iDriverDirList->Count()-1 ; i>=0 ; i--)
{
if ( (*iDriverDirList)[i].CompareF(parser.DriveAndPath())==0 )
return; // its already on the list, so dont add it again
}
iDriverDirList->AppendL(parser.DriveAndPath());
}
示例4: testWriteL
/**
@SYMTestCaseID SYSLIB-STORE-CT-1153
@SYMTestCaseDesc Tests for writing using a permanent file store
@SYMTestPriority High
@SYMTestActions Tests for memory and end of file error while creating the store.
Tests for writing to replaced,temporary,opened,created file.
Tests for creating an already existing file.
Tests for panic while deleting a file.
@SYMTestExpectedResults Test must not fail
@SYMREQ REQ0000
*/
LOCAL_C void testWriteL()
{
test.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1153 Creating and failing to open 'ghost' file "));
TDriveUnit drive(static_cast<TUint>(RFs::GetSystemDrive()));
TParse parse;
parse.Set(drive.Name(), &KFileLocationSpec, NULL);
TheFs.Delete(parse.NameAndExt());
CFileStore* store=CPermanentFileStore::CreateLC(TheFs,parse.NameAndExt(),EFileWrite);
CleanupStack::PopAndDestroy();
store=NULL;
TRAPD(r,store=CPermanentFileStore::OpenL(TheFs,parse.NameAndExt(),EFileRead|EFileWrite));
test(store==NULL&&r==KErrEof);
//
test.Next(_L("Empty tests on replaced file"));
store=CPermanentFileStore::ReplaceLC(TheFs,parse.NameAndExt(),EFileWrite);
store->SetTypeL(TUidType(KPermanentFileStoreLayoutUid,KPermanentFileStoreLayoutUid));
testEmptyL(*store);
CleanupStack::PopAndDestroy();
//
test.Next(_L("Writing to temp file"));
store=CPermanentFileStore::TempLC(TheFs,parse.DriveAndPath(),TheTempFile,EFileWrite);
store->SetTypeL(TUidType(store->Layout(),KNullUid,KPermanentFileStoreLayoutUid));
testWriteL(*store);
store->CommitL();
CleanupStack::PopAndDestroy();
(void)TheFs.Delete(TheTempFile);
//
test.Next(_L("Writing to temp file - 2"));
store=CPermanentFileStore::TempL(TheFs,parse.DriveAndPath(),TheTempFile,EFileWrite);
CleanupStack::PushL(store);
store->SetTypeL(TUidType(store->Layout(),KNullUid,KPermanentFileStoreLayoutUid));
testWriteL(*store);
store->CommitL();
CleanupStack::PopAndDestroy();
//
test.Next(_L("Writing to opened file"));
store=CPermanentFileStore::OpenLC(TheFs,parse.NameAndExt(),EFileRead|EFileWrite);
testWriteL(*store);
store->CommitL();
CleanupStack::PopAndDestroy();
//
test.Next(_L("Failing to create existing file"));
store=NULL;
TRAP(r,store=CPermanentFileStore::CreateL(TheFs,TheTempFile,EFileWrite));
test(store==NULL&&r==KErrAlreadyExists);
if (TheFs.Delete(parse.NameAndExt())!=KErrNone)
test.Panic(_L("Deleting file"));
//
test.Next(_L("Writing to created file"));
RFile file;
test(file.Create(TheFs,parse.NameAndExt(),EFileWrite)==KErrNone);
store=CPermanentFileStore::NewLC(file);
store->SetTypeL(KPermanentFileStoreLayoutUid);
testWriteL(*store);
store->CommitL();
CleanupStack::PopAndDestroy();
}
示例5: setup
void CT_MruStep::setup()
{
#if defined(__EPOC32__)
// if we're on the rack create the directories we need
TFullName filePath=_L("c:\\docs\\tstapp.doc");
TFullName tempPath=_L("c:\\system\\temp\\");
TParse parser;
parser.Set(filePath,NULL,NULL);
iFs.MkDirAll(parser.DriveAndPath());
parser.Set(tempPath,NULL,NULL);
iFs.MkDirAll(parser.DriveAndPath());
#endif
}
示例6: setupTestDirectory
//
// Prepare the test directory.
//
LOCAL_C void setupTestDirectory()
{
TInt r=TheFs.Connect();
test(r==KErrNone);
//
TDriveUnit drive(static_cast<TUint>(RFs::GetSystemDrive()));
TParse parse;
parse.Set(drive.Name(), &KFileLocationSpec, NULL);
r=TheFs.MkDir(parse.DriveAndPath());
test(r==KErrNone||r==KErrAlreadyExists);
r=TheFs.SetSessionPath(parse.DriveAndPath());
test(r==KErrNone);
}
示例7: DoChangeDriveL
void CMsvIndexContext::DoChangeDriveL(TUint aNewDriveIndex, TBool aIsRemovePartial, TDriveNumber& aNewDriveNumber)
{
iObserverStatus = NULL;
TMsvPreferredDrive driveEntry;
CMsvPreferredDriveList::GetDriveList()->DriveInfoL(aNewDriveIndex, driveEntry);
aNewDriveNumber = driveEntry.driveNum;
if(EMsvMessageStoreUnavailableStatus == driveEntry.status)
{
// Create the database and all standard table.
CMsvDBAdapter::CreateDBL(driveEntry.driveNum);
// Update the drive status.
CMsvPreferredDriveList::GetDriveList()->UpdateDriveStatusL(aNewDriveIndex, EMsvMessageStoreAvailableStatus);
TParse parse;
TPtrC drive(TDriveUnit(driveEntry.driveNum).Name());
parse.Set(KMsvDefaultIndexFile2(), &drive, NULL);
iMessageFolder = parse.DriveAndPath();
ResetAndCreateNewMailStoreL();
iRunMailInit = ETrue;
// Perform ChangeDrive operation.
iIndexAdapter->ChangeDriveL(aNewDriveIndex, aIsRemovePartial);
// Read initial entries from resources
CreateStandardEntriesFromResourceFileL(KCurrentDriveId);
iIndexAdapter->SetLocalServiceComplete();
}
else
{
// Update the message folder local variable.
TParse parse;
TPtrC drive(TDriveUnit(driveEntry.driveNum).Name());
parse.Set(KMsvDefaultIndexFile2(), &drive, NULL);
iMessageFolder = parse.DriveAndPath();
ResetAndCreateNewMailStoreL(EFalse);
// Perform ChangeDrive operation.
iIndexAdapter->ChangeDriveL(aNewDriveIndex, aIsRemovePartial);
iRunMailInit = EFalse;
}
// Create service directories in new drive.
TRAP_IGNORE(DoCreateServiceDirsL(KCurrentDriveId));
TRAP_IGNORE(LocalizeStandardFoldersL());
}
示例8: ScanDirL
LOCAL_C void ScanDirL(RFs& aFs, const TDesC& aDir)
{
User::After(1000000);
TParse parse;
parse.Set(_L("t_*.exe"), &aDir, NULL);
TPtrC spec(parse.FullName());
test.Start(parse.DriveAndPath());
TFindFile find(aFs);
CDir* dir;
if (!find.FindWildByPath(parse.FullName(), NULL, dir))
{
CleanupStack::PushL(dir);
for(int i = 0; i < dir->Count(); i++)
{
parse.Set((*dir)[i].iName, &spec, NULL);
if (i == 0)
test.Start(parse.FullName());
else
test.Next(parse.FullName());
LaunchAndWaitL(parse.FullName());
}
CleanupStack::PopAndDestroy(); // dir
}
test.End();
}
示例9: ConstructL
void CAknFileSettingPage::ConstructL(void)
{
BaseConstructL();
//listbox icons
CAknIconArray* icons=new(ELeave)CAknIconArray(2);
CleanupStack::PushL(icons);
icons->ConstructFromResourceL(R_CLOCKAPP_EXTRA_SETTING_ICONS);
FileControl()->ItemDrawer()->ColumnData()->SetIconArray(icons);
CleanupStack::Pop(); //icons
//listbox items
iFiles=new(ELeave)CDesCArrayFlat(32);
CTextListBoxModel* model=FileControl()->Model();
model->SetItemTextArray(iFiles); //old text array deleted by owner
model->SetOwnershipType(ELbmOwnsItemArray); //transfer ownership
TParse parse;
parse.SetNoWild(iFileValue,NULL,NULL);
TPtrC name=parse.NameAndExt(),path=parse.DriveAndPath();
TDesC* pos=&name;
if(!BaflUtils::PathExists(iFs,path))
{
pos=NULL;
iFileValue.Zero();
}
ReadFilesL(pos);
}
示例10: CreateDirectoryL
void CClipboard::CreateDirectoryL(const TDesC& aFileName)
{
TParse parser;
parser.Set(aFileName,NULL,NULL);
TInt err=iFsSession.MkDirAll(parser.DriveAndPath());
if (err!=KErrNone && err!=KErrAlreadyExists)
User::Leave(err);
}
示例11: GetFileName
void CCustomCommandAsync::GetFileName(TPtrC path, TFileName* fileName)
{
TParse p;
p.Set(path,NULL,NULL);
fileName->Append(p.DriveAndPath());
fileName->Append(p.Name());
fileName->Append(p.Ext());
}
示例12: SetDefaultDir
TInt PosixFilesystem::SetDefaultDir (RFs& aFs)
{
TParse parse;
parse.Set(RProcess().FileName(), NULL, NULL);
#ifdef __SECURE_DATA__
return aFs.SetSessionToPrivate(TDriveUnit(parse.Drive()));
#else
return aFs.SetSessionPath(parse.DriveAndPath());
#endif
}
示例13: GetAppPath
TFileName CMobileOfficeAppUi::GetAppPath()
{
TParse parse;
//On WINS the application is on the z drive
#ifdef __WINSCW__
TFileName appfullname = Application()->AppFullName();
parse.Set(_L("c:"), &appfullname, NULL);
#else
parse.Set( Application()->AppFullName(), NULL, NULL);
#endif
return ( parse.DriveAndPath() ); //Base
}
示例14: ReadFilesL
void CAknFileSettingPage::ReadFilesL(const TDesC* aPos)
{
TInt pos=-1;
iFiles->Reset();
FileControl()->Reset();
TFileName buffer;
if(iFileValue.Length())
{
buffer.Copy(KFolderIcon);
buffer.Append(KFolderUp);
iFiles->AppendL(buffer);
TParse parse;
parse.SetNoWild(iFileValue,NULL,NULL);
CDir* list;
User::LeaveIfError(iFs.GetDir(parse.DriveAndPath(),KEntryAttMaskSupported,ESortByName|EDirsFirst,list));
CleanupStack::PushL(list);
for(TInt i=0; i<list->Count(); i++)
{
const TDesC& name=(*list)[i].iName;
if((*list)[i].IsDir())
{
buffer.Copy(KFolderIcon);
}
else
{
if(name.MatchF(KMelodyMask1)<0&&name.MatchF(KMelodyMask2)<0&&name.MatchF(KMelodyMask3)<0&&name.MatchF(KMelodyMask4)<0) continue;
buffer.Copy(KMelodyIcon);
}
buffer.Append(name);
if(aPos&&name.MatchF(*aPos)>=0) pos=iFiles->Count();
iFiles->AppendL(buffer);
}
CleanupStack::PopAndDestroy(); //list
}
else
{
TDriveList drives;
User::LeaveIfError(iFs.DriveList(drives));
for(TInt drive=EDriveA; drive<=EDriveZ; drive++)
{
if(drives[drive])
{
buffer.Copy(KFolderIcon);
buffer.Append(drive+'a');
buffer.Append(':');
iFiles->AppendL(buffer);
}
}
}
FileControl()->HandleItemAdditionL();
if(pos!=-1) FileControl()->SetCurrentItemIndexAndDraw(pos);
UpdateFileL();
}
示例15: UpdateFileL
void CAknFileSettingPage::UpdateFileL(void)
{
if(iFileValue.Length())
{
TPtrC item=(*iFiles)[FileControl()->CurrentItemIndex()],name=item.Mid(2);
TParse parse;
parse.SetNoWild(iFileValue,NULL,NULL);
iFileValue=parse.DriveAndPath();
iFileValue.Append(name);
}
CheckAndSetDataValidity();
UpdateCbaL();
}