/** Setup dir structure for testing and verifying functional results @param datastr data structure to setup directory @param iOperation Operation to be performed @param SrcDrive Source drive @param Targetdrive Target drive input @panic if data structure definition is incorrect */ void SetupDirFiles(const TDesC& aPath, const TDirSetupFiles& aDirFiles) { TFileName path = aPath; if (path.Length() == 0) { test.Printf(_L("ERROR<SetupDirFiles()>: Zero length src path!\n")); test(EFalse); } MakeDir(path); RArray<TInt> addBlockDataArray; RArray<TInt> deductBlockDataArray; ParsingDirDataBlock(aDirFiles.iAddingBlock, addBlockDataArray); ParsingDirDataBlock(aDirFiles.iDeductBlock, deductBlockDataArray); if (addBlockDataArray.Count() == 0) // empty dir setup { return; } for (TInt i = 0; i < deductBlockDataArray.Count(); ++i) { TInt idxToDelete = addBlockDataArray.FindInOrder(deductBlockDataArray[i]); if (idxToDelete >= 0) { addBlockDataArray.Remove(idxToDelete); } else if (idxToDelete == KErrNotFound) { continue; } else { test.Printf(_L("ERROR<<SetupDir>>: wrong dir data setup! err=%d\n"), idxToDelete); test(EFalse); } } if (addBlockDataArray.Count() > 0) { for (TInt i = 0; i < addBlockDataArray.Count(); ++i) { TInt idx = addBlockDataArray[i]; path = aPath; path += gDirPatterns[idx]; if (path[path.Length() - 1] == '\\') { MakeDir(path); } else { MakeFile(path, _L8("blahblah")); } } } addBlockDataArray.Reset(); deductBlockDataArray.Reset(); }
void CFileEngine::RequestCreateFolder(const TDesC& aParentPath) { //ASSERT(NULL == iParentFolderName); delete iParentFolderName; iParentFolderName = NULL; iParentFolderName = aParentPath.AllocL(); TFileName szTempParentPath = aParentPath; if ( szTempParentPath[ szTempParentPath.Length() - 1 ] != '\\' ) { szTempParentPath.Append( _L("\\") ); } //获取路径深度 TInt dirDepth = 0; const TUint16* pSzTempParentPath = szTempParentPath.Ptr(); for ( TInt i = 0; i < szTempParentPath.Length(); i ++ ) { if ( pSzTempParentPath[ i ] == '\\' ) { dirDepth ++; } } if ( dirDepth >= 7 ) { iControlFactory.CreateTipDialog(iMainEngine.GetDesById(ETurkeyTextRes_CreateFolderNotSupported),*this,ECmdNull); delete iParentFolderName; iParentFolderName = NULL; } else { iControlFactory.CreateInputTextDialog(*this,iMainEngine.GetDesById(ETurkeyTextRes_InputFolderName),KNullDesC,ECmdCreateFolder); //iInputEvent = ECmdCreateFolder; } }
//static QFileSystemEntry QFileSystemEngine::currentPath() { TFileName fn; QFileSystemEntry ret; TInt r = qt_s60GetRFs().SessionPath(fn); if(r == KErrNone) { //remove terminating slash from non root paths (session path is clean, absolute and always ends in a \) if(fn.Length() > 3 && fn[fn.Length() - 1] == '\\') fn.SetLength(fn.Length() - 1); ret = QFileSystemEntry(qt_TDesC2QString(fn), QFileSystemEntry::FromNativePath()); } return ret; }
/** Function checks the sent parmaters and pancis client if any of its length is greater than KMaxFileName. Calculates the padded lengths of sent parameters and stores them in member variables @param aResourceDir directory name of animation description file @param aFilenameOutgoing File name of Outgoing phase of TFX @param aFilenameIncoming File name of Incoming phase of TFX */ void RTFXEffect::CheckFileNameAndSetSizes(const TFileName& aResourceDir, const TFileName& aFilenameOutgoing, const TFileName& aFilenameIncoming) { __ASSERT_ALWAYS(aResourceDir.Length() <= KMaxFileName, Panic(EW32PanicStringTooLong)); __ASSERT_ALWAYS(aFilenameOutgoing.Length() <= KMaxFileName, Panic(EW32PanicStringTooLong)); __ASSERT_ALWAYS(aFilenameIncoming.Length() <= KMaxFileName, Panic(EW32PanicStringTooLong)); iDirPathSizePaded = PaddedValue(aResourceDir.Size()); iFileName1SizePaded = PaddedValue(aFilenameOutgoing.Size()); iFileName2SizePaded = PaddedValue(aFilenameIncoming.Size()); iCombSizePaded = iDirPathSizePaded + iFileName1SizePaded + iFileName2SizePaded; }
/* ------------------------------------------------------------------------------- Class: CTestModule Method: CreateModuleSessionL Description: Creates a new module session. Just take the initialisation file name from message. Parameters: const RMessage& aMessage :inout: Message to be handled Return Values: TInt Operation result Errors/Exceptions: Leaves if memory allocation fails Status: Proposal ------------------------------------------------------------------------------- */ TInt CTestModule::CreateModuleSessionL( const RMessage2& aMessage ) { __TRACE( KMessage,( _L( "CTestModule::CreateModuleSession in" ) ) ); // Take parameters TFileName ini; TRAPD( res, aMessage.ReadL( 0, ini ) ); if( res != KErrNone ) { PanicClient( EBadDescriptor, aMessage ); return res; } // Construct heap buffer for initialization file name iIniBuffer = HBufC::NewL( ini.Length() ); iIni.Set ( iIniBuffer->Des() ); iIni.Copy ( ini ); aMessage.Complete( KErrNone ); __TRACE( KMessage,( _L( "CTestModule::CreateModuleSession out" ) ) ); return KErrNone; }
bool C_dir::RemoveDirectory(const wchar *path, bool recursively){ bool ok = true; if(recursively){ C_dir d; if(d.ScanBegin(path)){ while(true){ dword atts; const wchar *wp = d.ScanGet(&atts); if(!wp) break; Cstr_w fn; fn<<path <<'\\' <<wp; if(atts&C_file::ATT_DIRECTORY) ok = (RemoveDirectory(fn, true) && ok); else ok = (C_file::DeleteFile(fn) && ok); } d.ScanEnd(); } } Cstr_w dirw; C_file::GetFullPath(path, dirw); RFs file_session; RFs &fs = InitFileSession(file_session); TFileName n; n.Copy(TPtrC((word*)(const wchar*)dirw, dirw.Length())); if(n[n.Length()-1]!='\\') n.Append('\\'); ok = (fs.RmDir(n)==KErrNone && ok); CloseFileSession(file_session); return ok; }
TInt CTestUtils::AppendMainLogL() { _LIT(KDisplayLogFile,"Log File %S\n"); TParse loglocation; TFileName logfile; TInt err=ResolveLogFile(KNullDesC, loglocation); if(err!=KErrNone) { iFs.MkDirAll(KMsvTestFileDefaultOutputBase); err=ResolveLogFile(KNullDesC, loglocation); } User::LeaveIfError(err); logfile.Copy(loglocation.FullName()); logfile.Delete(logfile.Length()-1,1); AppendVariantName(logfile); iRTest.Printf(KDisplayLogFile, &logfile); iFs.MkDirAll(logfile); iLogBuf=HBufC::NewL(KMaxLogLineLength); iLogBuf8=HBufC8::NewL(KMaxLogLineLength); TInt pos=0; TInt ret=KErrNone; ret=iFile.Open(iFs,logfile,EFileWrite|EFileShareAny); if (ret==KErrNotFound) ret=iFile.Create(iFs,logfile,EFileWrite|EFileShareAny); if (ret==KErrNone) return(iFile.Seek(ESeekEnd,pos)); else return(ret); }
TInt CTestUtils::OpenMainLogL() { _LIT(KDisplayLogFile,"Log File %S\n"); TParse loglocation; TFileName logfile; TInt err=ResolveLogFile(KNullDesC, loglocation); if(err!=KErrNone) { TChar driveChar=RFs::GetSystemDriveChar(); TBuf<2> systemDrive; systemDrive.Append(driveChar); systemDrive.Append(KDriveDelimiter); TPath pathName(systemDrive) ; pathName.Append(KMsvTestFileDefaultOutputBase); iFs.MkDirAll(pathName); err=ResolveLogFile(KNullDesC, loglocation); } User::LeaveIfError(err); logfile.Copy(loglocation.FullName()); logfile.Delete(logfile.Length()-1,1); AppendVariantName(logfile); iRTest.Printf(KDisplayLogFile, &logfile); iFs.MkDirAll(logfile); iLogBuf=HBufC::NewL(KMaxLogLineLength); iLogBuf8=HBufC8::NewL(KMaxLogLineLength); return(iFile.Replace(iFs,logfile,EFileWrite|EFileShareAny)); }
// ----------------------------------------------------------------------------- // CTestSDKEditors::TestSEResetL // ----------------------------------------------------------------------------- // TInt CTestSDKEditors::TestSEResetL( CStifItemParser& /*aItem*/ ) { CEikSecretEditor* secretEditor = new (ELeave) CEikSecretEditor; CleanupStack::PushL( secretEditor ); STIF_ASSERT_NOT_NULL( secretEditor ); TResourceReader reader; CCoeEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDK_SECRETTEXT ); secretEditor->ConstructFromResourceL( reader ); CleanupStack::PopAndDestroy(); _LIT( KText, "Text" ); TFileName text( KText ); secretEditor->SetText( text ); secretEditor->Reset(); TFileName textGet; secretEditor->GetText( textGet ); STIF_ASSERT_EQUALS( 0, textGet.Length() ); CleanupStack::PopAndDestroy( secretEditor ); return KErrNone; }
TBool CIncallertAppUi::ProcessCommandParametersL(TApaCommand aCommand,TFileName& aDocumentName) #endif { #ifdef EKA2 if(aCommandLine.OpaqueData().Length() > 0) #else if(aDocumentName.Length() > 0) #endif { // Opaque data exists, app. has been manually started from the menu iAutoStarted = EFalse; iEikonEnv->RootWin().SetOrdinalPosition(-1,ECoeWinPriorityNormal); TApaTask task(iEikonEnv->WsSession( )); task.SetWgId(CEikonEnv::Static()->RootWin().Identifier()); task.BringToForeground(); DoConstuctL(); } else { iAutoStarted = ETrue; if(!CIncallertSettingsView::AutoStartEnabled()) { //prepare exit if(!iExitTimer) { iExitTimer = CPeriodic::NewL(0); iEikonEnv->RootWin().SetOrdinalPosition(-1,ECoeWinPriorityNeverAtFront); iExitTimer->Start( 5000000, 5000000, TCallBack(ExitTimerCallBack,this)); } #ifdef EKA2 return CEikAppUi::ProcessCommandParametersL( aCommandLine ); #else return CEikAppUi::ProcessCommandParametersL( aCommand,aDocumentName ); #endif } ////////autostart enabled: iEikonEnv->RootWin().SetOrdinalPosition(-1,ECoeWinPriorityNormal); DoConstuctL(); { TApaTask task(iEikonEnv->WsSession( )); task.SetWgId(CEikonEnv::Static()->RootWin().Identifier()); task.SendToBackground(); } //////////////// } #ifdef EKA2 return CEikAppUi::ProcessCommandParametersL( aCommandLine ); #else return CEikAppUi::ProcessCommandParametersL( aCommand,aDocumentName ); #endif }
void DeleteTestFiles() { if(TheDbName.Length() > 0) { (void)TheFs.Delete(TheDbName); } (void)TheFs.Delete(KTestFile3); (void)TheFs.Delete(KTestFile); }
QString ControllerWrapper::getCurrentConfigName() { #ifdef Q_OS_SYMBIAN TFileName fn; d_ptr->GetCurrentConfigName(fn); return QString((QChar*)fn.Ptr(),fn.Length()); #elif defined(_SIMULATOR_STUB) return QString(""); #endif }
void __fastcall TCDirectoryOutline::SetDirectory(const TFileName NewDir) { if (NewDir.Length() > 0) { TFileName Path = ForceCase(ExpandFileName(NewDir)); int n = Path.Length(); if (n > 3 && Path.IsPathDelimiter(n)) Path.SetLength(n - 1); if (Path != FDirectory) { FDirectory = Path; chdir(FDirectory.c_str()); if (!SameLetter(Path[1], Drive)) Drive = Path[1]; else { WalkTree(Path); Change(); } } } }
bool C_dir::MakeDirectory(const wchar *path, bool success_if_exists){ RFs file_session; RFs &fs = InitFileSession(file_session); TFileName n; n.Copy(TPtrC((word*)path, StrLen(path))); if(n[n.Length()-1]!='\\') n.Append('\\'); int err = fs.MkDir(n); CloseFileSession(file_session); if(success_if_exists && err==KErrAlreadyExists) return true; return (err==KErrNone); }
RArray<TFileName> ListImages::searchJPGL(TFileName tot, RFs fs, TFileName current) { RArray<TFileName> result; TInt i; TBuf<50> totalPath; TBuf<30> fileName; CDir* dirList; totalPath = tot; CleanupStack::PushL(dirList); if ((current.Length()) > 0) totalPath.Append(current); //CleanupClosePushL(result); TRAPD(err,fs.GetDir(totalPath, KEntryAttMaskSupported, ESortByDate, dirList)); CleanupStack::Pop(1); if (!dirList) return result; for (i = 0; i < dirList->Count(); i++) { if ((*dirList)[i].IsDir()) { TFileName tmp; tmp.Append((*dirList)[i].iName); tmp.Append(_L("\\")); RArray<TFileName> res = searchJPGL(totalPath, fs, tmp); for (int j = 0; j < res.Count(); j++) result.Append(res[j]); res.Reset(); } else { fileName = (*dirList)[i].iName; if (fileName.Find(_L(".jpg")) != KErrNotFound) { TBuf<50> tmp; tmp = totalPath; tmp.Append(fileName); result.Append(tmp); tmp.Delete(0, tmp.Length() - 1); } } } delete dirList; return result; }
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); }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ void CProfileSettings::SaveValuesL(void) { if(!iListBox) return; iListBox->StoreSettingsL(); TFileName DefaultFile; TFindFile AppFile(CCoeEnv::Static()->FsSession()); if(KErrNone == AppFile.FindByDir(KTraceSetFileName, KNullDesC)) { DefaultFile.Copy(AppFile.File()); } else { TFindFile AppFile2(CCoeEnv::Static()->FsSession()); if(KErrNone == AppFile2.FindByDir(KTraceIconsFileName, KNullDesC)) { TParsePtrC Hejlp(AppFile2.File()); DefaultFile.Copy(Hejlp.Drive()); DefaultFile.Append(KTraceSetFileName); } } if(DefaultFile.Length()) { User::LeaveIfError(CCoeEnv::Static()->FsSession().Delete(DefaultFile)); CDictionaryFileStore* MyDStore = CDictionaryFileStore::OpenLC(CCoeEnv::Static()->FsSession(),DefaultFile, TUid::Uid(0x102013AD)); if(iListBox->iEnabledOn) SaveValuesL(MyDStore,0x7777,0x100); else SaveValuesL(MyDStore,0x7777,0x000); SaveValuesL(MyDStore,0x5555,iListBox->iDrawStyle); SaveValuesL(MyDStore,0x8877,iListBox->iHorSlider); SaveValuesL(MyDStore,0x7788,iListBox->iVerSlider); SaveValuesL(MyDStore,0x6666,iListBox->iFontSize); MyDStore->CommitL(); CleanupStack::PopAndDestroy(1);// Store } }
void CDbCreator::DoStartL() { //process command line arguments //------------------------------ TBool extensionOnly( EFalse ); //Only extend CommsDat TBool dump( EFalse ); //Dump is needed not creation CCommandLineArguments* args = CCommandLineArguments::NewLC(); TFileName fileName; ParseCommandLineLC( args, fileName, extensionOnly, dump ); CCdcCommsDatCreator* cdc = CCdcCommsDatCreator::NewLC(); //checks filename argument if ( fileName.Length() == 0 ) { if( dump ) { fileName.Copy( KOutFile ); } else { fileName.Copy( KInFile ); } } //calls the appropriate function. if( dump ) { cdc->DumpCommsDatL( fileName ); } else if( extensionOnly ) { cdc->CreateTablesL(); } else { cdc->CreateTablesL(); cdc->CreateCommsDatL( fileName ); } CleanupStack::PopAndDestroy( 2, args); // args, cdc }
/* ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- */ void CEcomHandler::ReFreshHandlersL() { iHandlers.ResetAndDestroy(); RImplInfoPtrArray infoArray; REComSession::ListImplementationsL(KUidYTaskHandUID, infoArray); TFileName CurrName; for ( TInt i = 0; i < infoArray.Count(); i++ ) { CurrName.Zero(); CurrName.Copy(infoArray[i]->DisplayName()); CurrName.TrimAll(); TInt YStart = infoArray[i]->OpaqueData().Find(KtxStrtYTools); TInt YEnd = infoArray[i]->OpaqueData().Find(KtxEnddYTools); if(YStart != KErrNotFound && YEnd != KErrNotFound) { YStart = YStart + KtxStrtYTools().Length(); YEnd = (YEnd - YStart); if(YEnd > 0 ) { if(CurrName.Length() && CheckVersionL(infoArray[i]->OpaqueData().Mid(YStart,YEnd))) { CHandlerItem* newItem = new(ELeave)CHandlerItem(); CleanupStack::PushL(newItem); newItem->iUid = infoArray[i]->ImplementationUid(); newItem->iName = CurrName.AllocL(); newItem->iServerName = ParseInfoL(infoArray[i]->OpaqueData().Mid(YStart,YEnd),KtxStrtSERVER,KtxEnddSERVER); newItem->iIconfile = ParseInfoL(infoArray[i]->OpaqueData().Mid(YStart,YEnd),KtxStrtICONFILE,KtxEnddICONFILE); CleanupStack::Pop(newItem); iHandlers.Append(newItem); } } } } infoArray.ResetAndDestroy(); }
void CCntFileManagerMsgHandler::DefinitionsOfExistingViewsL(const RMessage2& aMessage) { TFileName fileName; ReadL(aMessage,KSlot0,fileName); if (fileName.Length() == 0) { Server().Controller().DefaultDatabaseL(fileName); } RPointerArray<CContactDefaultViewDefinition> viewDefs; CleanupResetAndDestroyPushL(viewDefs); CCntDbManager* manager = Server().Controller().DbManagerL(fileName); if (manager) { manager->ViewManagerL().GetDefinitionsOfExistingViewsL(viewDefs); } // Compute the size of the buffer that is needed. CBufFlat* buffer = CBufFlat::NewL(32); CleanupStack::PushL(buffer); RBufWriteStream writeStream(*buffer); CleanupClosePushL(writeStream); const TInt32 count = viewDefs.Count(); writeStream << count; for (TInt i = 0; i < count; i++) { writeStream << *viewDefs[i]; } // Check that the client-side write buffer is large enough. TInt length = buffer->Size(); if(aMessage.GetDesMaxLength(1) >= length) { aMessage.WriteL(1, buffer->Ptr(0)); aMessage.Complete(KErrNone); } else { aMessage.Complete(length); } CleanupStack::PopAndDestroy(3, &viewDefs); // writeStream, buffer, viewDefs }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ CYTasksContainer* CEcomHandler::GetHandlerL(CHandlerItem& aHandler,CEikButtonGroupContainer* aCba) { CYTasksContainer* Ret(NULL); TAny *impl; // pointer to interface implementation RImplInfoPtrArray infoArray; REComSession::ListImplementationsL(KUidYTaskHandUID, infoArray); TFileName CurrName; for ( TInt i = 0; i < infoArray.Count(); i++ ) { CurrName.Zero(); CurrName.Copy(infoArray[i]->DisplayName()); CurrName.TrimAll(); if(aHandler.iUid == infoArray[i]->ImplementationUid() && CurrName.Length() && aHandler.iName) { if(CurrName == aHandler.iName->Des()) { impl = REComSession::CreateImplementationL(infoArray[i]->ImplementationUid(), _FOFF(CYTasksContainer,iDestructorIDKey)); if ( impl ) { Ret = ((CYTasksContainer*)impl); Ret->iTasksHandlerExit = iTasksHandlerExit; CleanupStack::PushL(Ret); Ret->ConstructL(aCba); CleanupStack::Pop();//Ret break; } impl = NULL; } } } infoArray.ResetAndDestroy(); return Ret; }
QS60RFsSession() { qt_symbian_throwIfError(iFs.Connect()); qt_symbian_throwIfError(iFs.ShareProtected()); //BC with 4.7: create private path on system drive TInt sysdrive = iFs.GetSystemDrive(); TInt err = iFs.CreatePrivatePath(sysdrive); if (err != KErrNone && err != KErrAlreadyExists) qWarning("Failed to create private path on system drive."); TFileName pfn = RProcess().FileName(); TInt drive; if (pfn.Length() > 0 && iFs.CharToDrive(pfn[0], drive) == KErrNone) { //BC with 4.7: create private path on application drive (except rom or system drive which is done above) if (drive != sysdrive && drive != EDriveZ) { err = iFs.CreatePrivatePath(drive); if (err != KErrNone && err != KErrAlreadyExists) qWarning("Failed to create private path on application drive."); } //BC with 4.7: set working directory to same drive as application iFs.SetSessionToPrivate(drive); } }
TInt CWidgetRegistrySTIF::ClientSessionGetWidgetPathL( TTestResult& aResult ) { aResult.SetResult( KErrGeneral, KFailed ); RWidgetRegistryClientSession* registryClient; registryClient = new (ELeave) RWidgetRegistryClientSession; CleanupStack::PushL( registryClient ); TInt error = registryClient->Connect(); if ( KErrNone == error ) { TFileName fn; fn.SetLength( 0 ); registryClient->GetWidgetPath( iValidUid, fn ); if ( 0 < fn.Length() ) { aResult.SetResult( KErrNone, KPassed ); } registryClient->Disconnect(); } CleanupStack::PopAndDestroy( registryClient ); return KErrNone; }
QList<CContactItemField *> CntTransformAvatar::transformDetailL(const QContactDetail &detail) { if(detail.definitionName() != QContactAvatar::DefinitionName) User::Leave(KErrArgument); QList<CContactItemField *> fieldList; //cast to avatar const QContactAvatar &avatar(static_cast<const QContactAvatar&>(detail)); //create new field QString urlString = avatar.imageUrl().toString(); TPtrC fieldText(reinterpret_cast<const TUint16*>(urlString.utf16())); //copy filename and replace slash with a backslash TFileName filename; for(TInt i(0); i < fieldText.Length(); ++i) { if(i >= filename.MaxLength()) User::Leave(KErrTooBig); if(fieldText[i] == '/') { filename.Append('\\'); } else { filename.Append(fieldText[i]); } } if(filename.Length()) { TUid uid(KUidContactFieldCodImage); CContactItemField* newField = CContactItemField::NewLC(KStorageTypeText, uid); newField->SetMapping(KUidContactFieldVCardMapUnknown); newField->TextStorage()->SetTextL(filename); fieldList.append(newField); CleanupStack::Pop(newField); } return fieldList; }
/** * Verify Data integrity * * @param aMethod The verification method * @param aFileName File to verify * @param aChecksum Checksum * * @return N/A * * @leave System wide error */ void CT_DataVerify::VerifyData( const TDataVerifyMethod aMethod, const TFileName& aFileName, const TDesC& aChecksum ) { TBool dataOk = ETrue; if( aFileName.Length() > KMaxFileName) { ERR_PRINTF2(_L("Illegal filename: %S"), &aFileName); SetBlockResult(EFail); dataOk = EFalse; } if(dataOk) { THashBuf checksum; checksum.Append( aChecksum ); // Use MD5 to verify file if( aMethod == EDataVerifyMethodMD5 ) { // MD5 selected TRAPD(error, VerifyChecksumL( checksum, aFileName )); if(error == KErrNone) { INFO_PRINTF1(_L("Data verify succeeded.")); } else { ERR_PRINTF2(_L("Checksum verification left with error %d"), error); SetBlockResult(EFail); } } else { ERR_PRINTF1(_L("Verification method not supported")); SetBlockResult(EFail); } } }
TBool CFileExecuter::GetAssociatedApp( TFileName aFileExtension, TFileName& aAppPath ) { TBool aFoundType; CCoCoAppUi* nAppUi = (CCoCoAppUi*)(CEikonEnv::Static()->AppUi()); CDictionaryStore* nlinkStore = nAppUi->Application()->OpenIniFileLC( CEikonEnv::Static()->FsSession() ); aFileExtension.LowerCase(); const TUint16* aFileExtensionPtr = aFileExtension.Ptr(); TUint nDefaultUid = 0; TUint nMemberValue; for ( TInt i = 0; i < aFileExtension.Length(); i ++ ) { nMemberValue = aFileExtensionPtr[i]; if ( nMemberValue >= 97 && nMemberValue <= 122 ) { nMemberValue -= 97; } else if ( nMemberValue >= 48 && nMemberValue <= 57 ) { nMemberValue -= 48; } nDefaultUid = nDefaultUid* 10 + nMemberValue; } if ( nlinkStore->IsPresentL( TUid::Uid(nDefaultUid) ) ) { RDictionaryReadStream inLinkStoreStream; inLinkStoreStream.OpenLC( *nlinkStore, TUid::Uid(nDefaultUid) ); inLinkStoreStream >> aAppPath; CleanupStack::PopAndDestroy(); aFoundType = true; }
HXBOOL CHXDirectory::SetCurrentDir() { HXBOOL bRetVal = FALSE; if (GetSession()) { TFileName* psymbCurrentDir = new TFileName; if (psymbCurrentDir) { bRetVal = (m_symbSession.SessionPath(*psymbCurrentDir) == KErrNone); if (bRetVal) { m_strPath = (const char *) OS_STRING2((OS_TEXT_PTR) psymbCurrentDir->Ptr(), psymbCurrentDir->Length()); } delete psymbCurrentDir; } } return bRetVal; }
void CNfsAppUi::ConstructL() { TFileName fnb; fnb.Copy(Application()->AppFullName()); int l; for(l = fnb.Length()-1; l; l--) if(fnb[l] == '\\') break; fnb.SetLength(l+1); fnb.Append(_L("nfsclient.exe")); #if !defined(__int64) // Old SDK EikDll::StartExeL(fnb); #else RProcess pr; if(pr.Create(fnb,fnb) == KErrNone) { pr.Resume(); pr.Close(); } #endif User::Exit(0); }
QString QDesktopServices::storageLocation(StandardLocation type) { TFileName path; switch (type) { case DesktopLocation: qWarning("No desktop concept in Symbian OS"); // But lets still use some feasible default path.Append(writableDataRoot()); break; case DocumentsLocation: path.Append(writableDataRoot()); break; case FontsLocation: path.Append(KFontsDir); break; case ApplicationsLocation: path.Append(exeDrive().Name()); path.Append(KSysBin); break; case MusicLocation: path.Append(writableDataRoot()); #ifdef Q_OS_SYMBIAN path.Append(PathInfo::SoundsPath()); #endif break; case MoviesLocation: path.Append(writableDataRoot()); #ifdef Q_OS_SYMBIAN path.Append(PathInfo::VideosPath()); #endif break; case PicturesLocation: path.Append(writableDataRoot()); #ifdef Q_OS_SYMBIAN path.Append(PathInfo::ImagesPath()); #endif break; case TempLocation: return QDir::tempPath(); break; case HomeLocation: path.Append(writableDataRoot()); //return QDir::homePath(); break; break; case DataLocation: qt_s60GetRFs().PrivatePath(path); path.Insert(0, writableExeDrive().Name()); break; case CacheLocation: qt_s60GetRFs().PrivatePath(path); path.Insert(0, writableExeDrive().Name()); path.Append(KCacheSubDir); break; default: // Lets use feasible default path.Append(writableDataRoot()); break; } // Convert to cross-platform format and clean the path QString nativePath = QString::fromUtf16(path.Ptr(), path.Length()); QString qtPath = QDir::fromNativeSeparators(nativePath); qtPath = QDir::cleanPath(qtPath); // Note: The storage location returned can be a directory that does not exist; // i.e., it may need to be created by the system or the user. return qtPath; }
/* ------------------------------------------------------------------------------- Class: CStifFileParser Method: ReadLineL Description: Reads line from source file Parameters: TPtr& aLineBuffer: in: Descriptor in which line loads TPtr& aEndOfLineBuffer: in: Descriptor in which end of line sequence is loaded (0x0A or 0x0D 0x0A) Return Values: TBool: determines whether line was readed or not Errors/Exceptions: Leaves if seek command leaves Leaves if buffer is too small Status: Proposal ------------------------------------------------------------------------------- */ TBool CStifFileParser::ReadLineL(TPtr& aLineBuffer, TPtr& aEndOfLineBuffer) { //Variables TBuf8<128> buf8; TBuf16<128> buf16; TPtrC16 buf; TInt pos; TInt offset; TChar char0x0A = 0x000A; TChar char0x0D = 0x000D; TBuf<1> b0x0A; b0x0A.Append(char0x0A); //Reset buffers aLineBuffer.Zero(); aEndOfLineBuffer.Zero(); //Read from source User::LeaveIfError(iCurrentFile->Read(buf8)); buf16.Copy(buf8); if(iIsUnicode) buf.Set((TUint16 *)(buf8.Ptr()), buf8.Length() / 2); else buf.Set(buf16.Ptr(), buf16.Length()); while(buf.Length()) { //Search for end of line char pos = buf.Find(b0x0A); //If found, append readed data to output descriptor and move back file offset to correct position if(pos >= 0) { offset = -((buf.Length() - pos - 1) * iBytesPerChar); User::LeaveIfError(iCurrentFile->Seek(ESeekCurrent, offset)); buf.Set(buf.Ptr(), pos + 1); aLineBuffer.Append(buf); break; } //Otherwise, append whole buffer to output descriptor else { aLineBuffer.Append(buf); } //Read next part of data User::LeaveIfError(iCurrentFile->Read(buf8)); buf16.Copy(buf8); if(iIsUnicode) { buf.Set((TUint16 *)(buf8.Ptr()), buf8.Length() / 2); } else { buf.Set(buf16.Ptr(), buf16.Length()); } } //Set correct end of line buffer if(buf.Length() > 1) { if(buf[buf.Length() - 2] == char0x0D) { aEndOfLineBuffer.Append(char0x0D); } } if(buf.Length() > 0) { if(buf[buf.Length() - 1] == char0x0A) { aEndOfLineBuffer.Append(char0x0A); } else { aEndOfLineBuffer.Zero(); } } if(aEndOfLineBuffer.Length()) { aLineBuffer.SetLength(aLineBuffer.Length() - aEndOfLineBuffer.Length()); } //If no data was found, try to get previous file from stack if(aLineBuffer.Length() + aEndOfLineBuffer.Length() == 0) { //Pop file from stack. If stack is empty, then we achieved end of base file if(!iFileStack->IsEmpty()) { PopFromFileStack(); aEndOfLineBuffer.Copy(iEolBuf); return aEndOfLineBuffer.Length(); } } //Check if this is include line else { if(aLineBuffer.Find(KIncludeKeyword) == 0) { TFileName fn; TLex lex(aLineBuffer); fn.Copy(lex.NextToken()); //get INCLUDE keyword fn.Copy(lex.NextToken()); //get cfg file name if(fn.Length() > 0) { TStifUtil::CorrectFilePathL( fn ); PushFileToStackL(fn); iEolBuf.Copy(aEndOfLineBuffer); } else { __TRACE(KError, (_L("No filename was given after INCLUDE. Ignoring"))); } //Read next line return ReadLineL(aLineBuffer, aEndOfLineBuffer); } } return aLineBuffer.Length() + aEndOfLineBuffer.Length(); }