コード例 #1
0
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
0
ファイル: Tap2MenuAppUi.cpp プロジェクト: kolayuk/Tap2Menu
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
0
ファイル: PRNSETUP.CPP プロジェクト: cdaffara/symbiandump-mw1
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
0
/**
@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
0
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
0
//
// 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
0
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
0
ファイル: AUTORUN.CPP プロジェクト: cdaffara/symbiandump-mw2
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
0
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
0
ファイル: TSTCLIPB.CPP プロジェクト: cdaffara/symbiandump-os2
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
0
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
0
ファイル: POSIXFS.CPP プロジェクト: kuailexs/symbiandump-os2
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
0
 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
0
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
0
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();
}
コード例 #16
0
EXPORT_C void CSchSendTestUtils::CleanScheduleFolderL()
	{
	CFileMan* fileMan = CFileMan::NewL(iFs); 
	CleanupStack::PushL(fileMan);
	TParse parse;
	TFileName fileName(_L("\\system\\schedules\\")); 
	TBuf<4> drive=_L("C:");
	parse.Set(fileName, &drive, NULL);
	TInt error = fileMan->RmDir(parse.DriveAndPath()); 
	error = iFs.RmDir(parse.DriveAndPath());
	
	if (!(error==KErrNotFound||error==KErrNone))
		{
        TPtrC driveAndPath = parse.DriveAndPath();
		Printf(_L("Directory %S cannot be removed. Error=%d"), &driveAndPath, error);
		Printf(_L("Please ensure directory is not in use.\n"));
		User::Leave(error);
		}

	iFs.MkDirAll(parse.DriveAndPath());

	CleanupStack::PopAndDestroy(fileMan);
	}
コード例 #17
0
ファイル: Tap2MenuAppUi.cpp プロジェクト: kolayuk/Tap2Menu
void CTap2MenuAppUi::ReadSettings()
	{
	TInt err=KErrNone;
	iSettings.Reset();
	if (BaflUtils::FileExists(CEikonEnv::Static()->FsSession(),KSettingPath)) //!!!!!!!!!!!!!!!!!!!!!!!!!!!
		{
		TBuf<255> val;
		RFile filesave;
		TBuf<10> t;
		TFileText ft;
		TUint32 IntVal;
		filesave.Open(CEikonEnv::Static()->FsSession(), KSettingPath, EFileRead);
		ft.Set(filesave);
		while (ft.Read(val)==KErrNone)
			{
			TLex conv(val);
			conv.Val(IntVal,EDecimal);
			iSettings.Append(IntVal);
			}
		filesave.Close();
		}
	else
		{
		TParse parse;
		CEikonEnv::Static()->FsSession().Parse(KSettingPath,parse);
		if (!BaflUtils::FolderExists(CEikonEnv::Static()->FsSession(),parse.DriveAndPath()))
			{
			CEikonEnv::Static()->FsSession().MkDirAll(parse.DriveAndPath());
			}
		iSettings.Append(KPosXP);
		iSettings.Append(KPosYP);
		iSettings.Append(KPosXL);
		iSettings.Append(KPosYL);
		iSettings.Append(KSize);
		WriteSettings();
		}
	}
コード例 #18
0
ファイル: POSIXFS.CPP プロジェクト: kuailexs/symbiandump-os2
int PosixFilesystem::mkdir (RFs& aFs, const wchar_t* aPath, int perms, int& anErrno)
{
    TParse name;
    TInt err=GetFullPath(name,(const TText16 *)aPath,aFs,NULL);
    if (!err)
    {
        TPtrC path=name.DriveAndPath();
        err=aFs.MkDir(path);
        if (!err)
        {
            if ((perms&S_IWUSR)==0)
                err=aFs.SetAtt(path,KEntryAttReadOnly,0);
        }
    }
    return MapError(err,anErrno);
}
コード例 #19
0
void CFileEngine::CancelSaveAs()
{
	CFileBrowser* fileBrowser = iControlFactory.CreateFolderBrowser(*this,ECmdSaveAs,ECmdCancelSaveAs);

	if(iSaveAsDstPath->Length()>3)
	{
		if(iSaveAsDstPath->Right(2).Compare(_L(":\\"))!=0)
		{
			TParse parse;
			parse.Set(iSaveAsDstPath->Left(iSaveAsDstPath->Length()-1),NULL,NULL);

			fileBrowser->SetPath(parse.DriveAndPath());
		}
	}
	delete iSaveAsDstPath;
	iSaveAsDstPath = NULL;
}
コード例 #20
0
// ---------------------------------------------------------
// CPhoneStateHandle::LoadLibraryHandleL
// ---------------------------------------------------------
void CPhoneStateHandle::LoadLibraryHandleL( 
    const TDesC& aFileName,
    const TUid aFactoryUid )
    {

    TBool factoryFound = EFalse;
    TParse fullentry;
    fullentry.Set( aFileName, NULL, NULL );

    if ( iFactoryLibrary.Load( fullentry.Name(), fullentry.DriveAndPath() ) 
        == KErrNone )
        {
        if ( iFactoryLibrary.Type()[1] == aFactoryUid )
            {
            factoryFound = ETrue;
            }
        else
            {
            iFactoryLibrary.Close();
            }
        }

    // If Factory not found:
    if ( !factoryFound )
        {
        Panic( EPhoneCtrlFactoryLibraryNotFound );
        }
    // Look for the 1st exported function
    iEntry = iFactoryLibrary.Lookup( KPhoneUiStateMachineOrdinal ); 

    // Create the state machine factory
    iStateMachineFactory = (CPhoneUIStateMachineFactoryBase*) iEntry();

    // Create the state machine
    iPhoneStateMachine = iStateMachineFactory->CreatePhoneStateMachineL(
        iViewCommandHandle );

    // Create the phone resource resolver
    iPhoneResourceResolver = 
        iStateMachineFactory->CreatePhoneResourceResolverL();
    
    // Create the phone error messages handler    
    iPhoneErrorMessagesHandler = 
        iStateMachineFactory->CreatePhoneErrorMessagesHandlerL( 
                            iViewCommandHandle, iPhoneStateMachine );
    }
コード例 #21
0
void RemoveDirectoryTreeL(RFs& aFs, const TDesC& aFileName)
	{
	TParse directory;
	User::LeaveIfError(directory.SetNoWild(aFileName, NULL, NULL));
	while(!directory.IsRoot())
		{
		// try to remove this directory
		TInt err = aFs.RmDir(directory.DriveAndPath());
		if(err == KErrInUse || err == KErrAccessDenied)
			{
			break;
			}
		VerifyDeletionErrorL(err);		
		// move to deleted directory's parent
		User::LeaveIfError(directory.PopDir());
		}	
	}
コード例 #22
0
/**
@SYMTestCaseID          SYSLIB-STORE-CT-1188
@SYMTestCaseDesc	    Creation of empty files test
@SYMTestPriority 	    High
@SYMTestActions  	    Tests by opening empty dictionary file and interrogate it.
                        Tests for opening a stream that does not exist.Tests for reading from the empty file
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
LOCAL_C void emptyFileTestsL()
	{
	// set things up...
	TDriveUnit drive(static_cast<TUint>(RFs::GetSystemDrive()));	
	TParse dicFilePath;
	dicFilePath.Set(drive.Name(), &KDicFilePath, NULL);
	
	TInt ret = TheFs.MkDirAll(dicFilePath.DriveAndPath());
		test((ret==KErrNone)||(ret==KErrAlreadyExists));
	TheFs.Delete(dicFilePath.FullName()); // delete the file if it already exists
	//
	//
	test.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1188 Create a new file, close it while still empty, then open it again "));
	// create a new dictionary file and close it immediately
	CDictionaryFileStore* dicFile=NULL;
	TRAP(ret, dicFile = CDictionaryFileStore::OpenL(TheFs,dicFilePath.FullName(),dicFileUid));
		test(ret==KErrNone);
	TRAP(ret, dicFile->CommitL());
		test(ret==KErrNone);
	delete dicFile;
	dicFile = NULL;
	//
	// open the empty dic file and interogate it
	TRAP(ret, dicFile = CDictionaryFileStore::OpenL(TheFs,dicFilePath.FullName(),dicFileUid));
		test(ret==KErrNone);
	test(!dicFile->IsPresentL(testUid1));
	test(!dicFile->IsPresentL(testUid2));
	test(!dicFile->IsPresentL(testUid3));
	//
	//
	test.Next(_L("Open a stream that doesn't exist"));
	// open a stream that does not exist - should get an empty one
	RDictionaryReadStream readStream;
	TRAP(ret, readStream.OpenL(*dicFile,testUid1));
		test(ret==KErrNone);
	// try to read from it to check that it's empty
	TUint8 b;
	test(readStream.Source()->ReadL(&b,1)==0);
	readStream.Close();
	//
	//
	// tidy up
	delete dicFile;
	
	}
コード例 #23
0
void CScummVMUi::ConstructL() {
	BaseConstructL();
	TBuf<128> startFile;
	startFile = iEikonEnv->EikAppUi()->Application()->AppFullName();
	TParse parser;
	parser.Set(startFile,NULL,NULL);

	startFile = parser.DriveAndPath();
#ifndef __WINS__
	startFile.Append( _L("ScummVM.exe"));
#else
	startFile.Append( _L("ScummVM.dll"));
#endif
	CApaCommandLine *cmdLine = CApaCommandLine::NewLC(startFile);
	RApaLsSession lsSession;

	lsSession.Connect();
	CleanupClosePushL(lsSession);
	lsSession.StartApp(*cmdLine, iThreadId);

	CleanupStack::PopAndDestroy();//close lsSession
	CleanupStack::PopAndDestroy(cmdLine);

	User::After(500000);// Let the application start

	TApaTaskList taskList(iEikonEnv->WsSession());

	TApaTask myTask = taskList.FindApp(TUid::Uid(0x101f9b57));
	myTask.SendToBackground();

	TApaTask exeTask = taskList.FindByPos(0);

	iExeWgId=exeTask.WgId();
	exeTask.BringToForeground();

	if(iExeWgId == myTask.WgId()) { // Should n't be the same
		Exit();
	}
	if(iThreadWatch.Open(iThreadId) == KErrNone) {
		iWatcher = new (ELeave)CScummWatcher;
		iWatcher->iAppUi = this;
		iThreadWatch.Logon(iWatcher->iStatus);
	}
}
コード例 #24
0
ファイル: POSIXFS.CPP プロジェクト: kuailexs/symbiandump-os2
int PosixFilesystem::chdir (RFs& aFs, const wchar_t* aPath, int& anErrno)
{
    TParse name;
    TInt err=GetFullPath(name, (const TText16 *)aPath, aFs, NULL);
    if (!err)
    {
        TPtrC path=name.DriveAndPath();
        TUint att=0;
        if (path.Length()==3)	// Problem in F32 - the root directory has no attributes
            att=KEntryAttDir;
        else
            err=aFs.Att(path, att);
        if (!err)
            if (att&KEntryAttDir)
                err=aFs.SetSessionPath(path);
            else
                err=ENOTDIR;
    }
    return MapError(err,anErrno);
}
コード例 #25
0
// EPOC default constructor can leave.
void CPosResourceReader::ConstructL(const TDesC& aPath)
    {
    User::LeaveIfError(iFileSession.Connect());

    TFindFile* filefinder = new (ELeave) TFindFile(iFileSession);
    CleanupStack::PushL(filefinder);

    TParse* fileparser = new (ELeave) TParse;
    CleanupStack::PushL(fileparser);
    fileparser->Set(aPath, NULL, NULL);

    User::LeaveIfError(filefinder->FindByDir(fileparser->NameAndExt(),
        fileparser->DriveAndPath()));
    
    iResourceFile.OpenL(iFileSession, filefinder->File());
    iResourceFile.ConfirmSignatureL(0);
    
    CleanupStack::Pop(2, filefinder); // fileparser
    delete filefinder;
    delete fileparser;
    }
コード例 #26
0
ファイル: POSIX.CPP プロジェクト: cdaffara/symbiandump-os2
GLDEF_C TInt GetFullFile(TFileName& aName, const TText16* upath, RFs& aSession)
// Use GetFullPath to establish the pathname, then add the filename onto the end
	{
	TParse path;
	TInt err = GetFullPath(path,upath,aSession,&aName);
	if (err!=KErrNone)
		return err;
	// Wildcard drive letter for searching across drives
	if (upath[0]==L'?' && upath[1]==L':')
		{
		TFindFile search(aSession);
		err=search.FindByDir(aName,path.Path());
		if (!err)
			{
			aName=search.File();
			return KErrNone;
			}
		}
	err = path.SetNoWild(path.DriveAndPath(),NULL,&aName);
	if (!err)
		aName = path.FullName();
	return err;
	}
コード例 #27
0
void CResourceManager::CleanCachedPage(nid aPageId)
{
    int len = GetCachePath().Length();
    HBufC* cache = HBufC::New(len + 64);
    TPtr p = cache->Des();
    TPtr path = GetCachePath();
    p.Format(KCachePathFormat, &path, aPageId);
    
    _LIT(KWildName, "*.*");
    RFs& fs = CCoeEnv::Static()->FsSession();
    TFindFile file_finder(fs);
    CDir* file_list;
    TInt err = file_finder.FindWildByDir(KWildName, p, file_list);
    while (err == KErrNone) {
        for (TInt i = 0; i < file_list->Count(); i++) {
            if ((*file_list)[i].IsDir())
                continue;

            TParse fullentry;
            fullentry.Set((*file_list)[i].iName, &file_finder.File(), NULL);
            if (fullentry.ExtPresent()) {
                err = fs.Delete(fullentry.FullName());
            }
            else {
                TFileName filename;
                filename.Append(fullentry.DriveAndPath());
                filename.Append(fullentry.Name());
                err = fs.Delete(filename);
            }
        }
        delete file_list;
        err = file_finder.FindWild(file_list);
    }

    err = fs.RmDir(p);
    delete cache;
}
コード例 #28
0
void CFileEngine::RenameFile(const TDesC& aNewFileName)
{
	ASSERT(iRenameFile);
	if(aNewFileName.Length() > 0)
	{
		TParse parse;
		parse.Set(*iRenameFile,NULL,NULL);

		TFileName newFilePath;

		newFilePath.Append(parse.DriveAndPath());
		newFilePath.Append(aNewFileName);

		TInt err = 0;

		err=BaflUtils::RenameFile(iFs,*iRenameFile,newFilePath);

		delete iRenameFile;
		iRenameFile = NULL;
		if(err!=0)
		{
			iControlFactory.CreateTipDialog(iMainEngine.GetDesById(ETurkeyTextRes_DirReNameFailed),*this,ECmdNull);
		}
		else
		{
			if(iObserver)
			{
				iObserver->Update(EDeleteCompleted);
			}
		}
	}
	else
	{
		iControlFactory.CreateInputTextDialog(*this,iMainEngine.GetDesById(ETurkeyTextRes_ReName),iMainEngine.GetDesById(ETurkeyTextRes_InputNull),ECmdRenameFile);
	}
}
コード例 #29
0
ファイル: POSIXFS.CPP プロジェクト: kuailexs/symbiandump-os2
int PosixFilesystem::rmdir (RFs& aFs, const wchar_t* aPath, int& anErrno)
{
    TParse name;
    TInt err=GetFullPath(name,(const TText16 *)aPath,aFs,NULL);
    if (!err)
    {
        TPtrC path=name.DriveAndPath();
        TUint att=0;
        if (path.Length()==3)
            err=EPERM;	// no, you may not remove the root directory
        else
            err=aFs.Att(path, att);
        if (!err)
            if (att&KEntryAttDir)
            {
                err=aFs.RmDir(path);
                if (err==KErrInUse)
                    err=EEXIST;	// i.e. directory not empty
            }
            else
                err=ENOTDIR;
    }
    return MapError(err,anErrno);
}
コード例 #30
0
/**
Test the System ini file

@SYMTestCaseID          SYSLIB-STORE-CT-1186
@SYMTestCaseDesc	    Tests for CDictionaryFileStore::SystemL() function
@SYMTestPriority 	    High
@SYMTestActions  	    Tests for creation of system file.Tests for basic operations on the file
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
LOCAL_C void systemTestL()
	{
	TDriveUnit drive(static_cast<TUint>(RFs::GetSystemDrive()));	
	TParse systemIniFile;
	TParse backupSystemIniFile;
	systemIniFile.Set(drive.Name(), &KSystemIniFile, NULL);
	backupSystemIniFile.Set(drive.Name(), &KBackupSystemIniFile, NULL);

	TheFs.Rename(systemIniFile.FullName(),backupSystemIniFile.FullName());
	TParse parse;
	parse.Set(systemIniFile.FullName(),NULL,NULL);
	TheFs.RmDir(parse.DriveAndPath());
//
	test.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1186 Create system file "));
	CDictionaryFileStore* dicFile=NULL;
	TRAPD(ret, dicFile = CDictionaryFileStore::SystemL(TheFs));
	test(ret==KErrNone);
	TEntry entry;
	TInt err = TheFs.Entry(systemIniFile.FullName(),entry);
	test (err==KErrNone);
	Test1L(dicFile);
	test.Next(_L("Opening system file"));
	TRAP(ret, dicFile = CDictionaryFileStore::SystemL(TheFs));
		test(ret==KErrNone);
	Test2L(dicFile);
	TRAP(ret, dicFile = CDictionaryFileStore::SystemL(TheFs));
		test(ret==KErrNone);
	Test3L(dicFile);
	
	TRAP(ret, dicFile = CDictionaryFileStore::SystemL(TheFs));
	test(ret==KErrNone);
	Test6L(dicFile);
	
	TheFs.Delete(systemIniFile.FullName());
	TheFs.Rename(backupSystemIniFile.FullName(),systemIniFile.FullName());
	}