本文整理汇总了C++中TDriveUnit::Name方法的典型用法代码示例。如果您正苦于以下问题:C++ TDriveUnit::Name方法的具体用法?C++ TDriveUnit::Name怎么用?C++ TDriveUnit::Name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDriveUnit
的用法示例。
在下文中一共展示了TDriveUnit::Name方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CleanUpResFilesL
void CTErrorStep::CleanUpResFilesL()
{
// Delete error rsc files in C: drive (accordingly, we remove the read-only attr kept from rom)
// They need to be unlocked first
CBaBackupSessionWrapper* backupSession = CBaBackupSessionWrapper::NewL();
CleanupStack::PushL(backupSession);
TFileName fileName;
for(TInt index=EResFile1; index<=EResFile5; ++index)
{
ResFileFullName(fileName, TTErrorResFile(index));
backupSession->CloseFileL(fileName, MBackupObserver::EReleaseLockNoAccess);
User::After(100000); // wait 0.1s to allow the files to be closed
User::LeaveIfError(iUtils.SetReadOnly(fileName, 0));
User::LeaveIfError(iUtils.DeleteFileL(fileName));
}
CleanupStack::PopAndDestroy(backupSession);
// Delete error lang rsc files in C: drive (accordingly, we remove the read-only attr kept from rom)
User::LeaveIfError(iUtils.SetReadOnly(KTErrorLang1Tgt, 0));
User::LeaveIfError(iUtils.DeleteFileL(KTErrorLang1Tgt));
User::LeaveIfError(iUtils.SetReadOnly(KTErrorLang3Tgt, 0));
User::LeaveIfError(iUtils.DeleteFileL(KTErrorLang3Tgt));
User::LeaveIfError(iUtils.SetReadOnly(KTErrorLang6Tgt, 0));
User::LeaveIfError(iUtils.DeleteFileL(KTErrorLang6Tgt));
// Find where the removable media is (can vary on hardware builds)
TDriveUnit drive;
FindRemovableMediaL(drive);
// Delete files in removable drive (accordingly, we remove the read-only attr kept from rom)
TBuf<128> bufName;
bufName = drive.Name();
bufName.Append(KTErrorLang2Tgt);
User::LeaveIfError(iUtils.SetReadOnly(bufName, 0));
User::LeaveIfError(iUtils.DeleteFileL(bufName));
bufName.Zero();
bufName = drive.Name();
bufName.Append(KTErrorLang4Tgt);
User::LeaveIfError(iUtils.SetReadOnly(bufName, 0));
User::LeaveIfError(iUtils.DeleteFileL(bufName));
bufName.Zero();
bufName = drive.Name();
bufName.Append(KTErrorLang5Tgt);
User::LeaveIfError(iUtils.SetReadOnly(bufName, 0));
User::LeaveIfError(iUtils.DeleteFileL(bufName));
bufName.Zero();
bufName = drive.Name();
bufName.Append(KTErrorLang7Tgt);
User::LeaveIfError(iUtils.SetReadOnly(bufName, 0));
User::LeaveIfError(iUtils.DeleteFileL(bufName));
}
示例2: ConstructL
void CCompare::ConstructL(const TTestActionSpec& aTestActionSpec)
{
CKeyStoreTestAction::ConstructL(aTestActionSpec);
TInt err = KErrNone;
TInt pos = 0;
TDriveUnit sysDrive (RFs::GetSystemDrive());
TBuf<128> ramDrive (sysDrive.Name());
ramDrive.Append(_L("\\tkeystore\\data\\"));
iOriginalFile = ramDrive;
iNewFile = ramDrive;
TFileName buf;
buf.FillZ();
buf.Copy(Input::ParseElement(aTestActionSpec.iActionBody,
KOriginalFile,
KOriginalFileEnd, pos, err));
// Now the filename itself
iOriginalFile.Append(buf);
buf.Copy(Input::ParseElement(aTestActionSpec.iActionBody,
KNewFile,
KNewFileEnd, pos, err));
// Now the filename itself
iNewFile.Append(buf);
// iExpectedResult = SetExpectedResultL(Input::ParseElement(aTestActionSpec.iActionResult,
// KReturnStart,
// KReturnEnd, pos, err));
}
示例3: LogL
void CTLogger::LogL(const TDesC& aString)
{
// Open the file server and file
RFs fs;
User::LeaveIfError(fs.Connect());
CleanupClosePushL(fs);
// Open the file or create it if doesn't exist, create it
RFile file;
TDriveUnit sysDrive (fs.GetSystemDrive());
TBuf<128> logFile (sysDrive.Name());
logFile.Append(KLogFilename);
TInt error = file.Open(fs, logFile, EFileWrite|EFileShareAny);
if (error == KErrNotFound)
{
error = file.Create(fs, logFile, EFileWrite|EFileShareAny);
}
User::LeaveIfError(error);
CleanupClosePushL(file);
// Seek to the end of the file
TInt tmp = 0;
file.Seek(ESeekEnd, tmp);
// And do some logging
TBuf8<MAX_LEN> buf;
buf.Copy(aString);
file.Write(buf);
file.Write(KNewLine);
// Close and tidy up
CleanupStack::PopAndDestroy(2, &fs);
}
示例4: RunTestL
void CPolicyTest::RunTestL(TRequestStatus& aStatus)
{
HBufC* hptr16;
hptr16 = CnvUtfConverter::ConvertToUnicodeFromUtf8L(*iNameInfo);
RDebug::Print(KFormat,hptr16);
delete hptr16;
TDriveUnit sysDrive (RFs::GetSystemDrive());
TDriveName sysDriveName (sysDrive.Name());
TBuf<128> passScriptFile (sysDriveName);
passScriptFile.Append(KPassScriptPath);
TBuf<128> failScriptFile (sysDriveName);
failScriptFile.Append(KFailScriptPath);
TPtrC script = (iTestState == ETestPass) ? passScriptFile : failScriptFile;
(iTestState == ETestPass) ? RDebug::RawPrint(KPassTestRunning) : RDebug::RawPrint(KFailTestRunning);
TBuf<128> logTmpFile (sysDriveName);
logTmpFile.Append(KLogTmpPath);
iFs.Delete(logTmpFile); // ignore errors
TBuf<128> commandLine;
commandLine.AppendFormat(_L("%S %S"), &script, &logTmpFile);
StartProcessL(iTestExeTmpNewPath, commandLine, aStatus);
}
示例5: ExecuteConfigurationUpdateL
/**
Executes the supported operations specified in the given database
configuration file and updates the settings table to store the
version of this configuration file.
@param aFileData The database file data
@param aMatchingConfigFile The configuration file that is to be processed
@param aDbConfigFileVersion The configuration file version
@param aDbName Logical database name: "main" for the main database or attached database name
@leave KErrNoMemory, if an out of memory condition occurs.
One of the other system-wide error codes if the configuration
file fails to be opened or read.
One of the SQL errors of ESqlDbError type if the update to the
database settings table fails
@panic SqlDb 2 In _DEBUG mode if iDbHandle is NULL (uninitialized TSqlDbSysSettings object).
*/
void TSqlDbSysSettings::ExecuteConfigurationUpdateL(const TSqlSrvFileData& aFileData,
const TDesC& aMatchingConfigFile,
TInt aDbConfigFileVersion,
const TDesC& aDbName)
{
__ASSERT_DEBUG(iDbHandle != NULL, __SQLPANIC(ESqlPanicInvalidObj));
//Execute the specified database config file operations that are supported
#ifdef SYSLIBS_TEST
TDriveUnit drive = EDriveC;
#else
TDriveUnit drive = EDriveZ;
#endif
TFileName configFilePath;
TDriveName drvName = drive.Name();
configFilePath.Append(drvName);
configFilePath.Append(aFileData.PrivatePath());
configFilePath.Append(aMatchingConfigFile);
//If this method leaves then either the config file could not be
//opened or read or an out of memory condition occured. Either way
//another attempt will be made to process the config file when the
//database is next opened
DoExecuteDbConfigFileOpsL(aFileData.Fs(), configFilePath, aDbName);
//Now update the settings table to store the current version of the database config file.
//If this fails then another attempt will be made to process the config file and update
//the settings table when the database is next opened
TBuf<sizeof(KUpdateFileVersionSettingsSql) + KMaxFileName + 10> buf;
buf.Format(KUpdateFileVersionSettingsSql(), &aDbName, aDbConfigFileVersion);
__SQLLEAVE_IF_ERROR(::DbExecStmt16(iDbHandle, buf));
}
示例6: PerformAction
void CPolicyTest::PerformAction(TRequestStatus& aStatus)
{
if (aStatus < 0)
{
iState = EFinished;
}
switch (iState)
{
case EInit:
{
TDriveUnit sysDrive (RFs::GetSystemDrive());
TDriveName sysDriveName (sysDrive.Name());
TBuf<128> scriptFile (sysDriveName);
scriptFile.Append(KPassScriptPath);
WriteScriptFileL(scriptFile, *iPassAction);
scriptFile.Copy(sysDriveName);
scriptFile.Append(KFailScriptPath);
WriteScriptFileL(scriptFile, *iFailAction);
}
// fall through
case ESetupTest:
GetNextTest();
if (iTestState == ETestFinished)
{
iState = EFinished;
TRequestStatus* status = &aStatus;
User::RequestComplete(status, KErrNone);
}
else
{
SetupTestL(aStatus);
iState = ERunTest;
}
break;
case ERunTest:
CheckProcessTermintationL();
RunTestL(aStatus);
iState = EProcessResults;
break;
case EProcessResults:
CheckProcessTermintationL();
ProcessResultsL(aStatus);
iState = ESetupTest;
break;
case EFinished:
iActionState = EPostrequisite;
TRequestStatus* status = &aStatus;
User::RequestComplete(status, aStatus.Int());
break;
}
}
示例7: callExampleL
LOCAL_D void callExampleL() // initialize and call example code under cleanup stack
{
START_SCRIPT_LIST
SCRIPT_ITEM(CRSAEncryptFB,_L8("RSAEncryptStandardAndCRTFB")),
SCRIPT_ITEM(CRSASignFB,_L8("RSASignStandardAndCRTFB")),
SCRIPT_ITEM(CDSASignFB,_L8("DSASignFB")),
SCRIPT_ITEM(CRSAEncryptVector,_L8("RSAEncryptVector")),
SCRIPT_ITEM(CRSADecryptVector,_L8("RSADecryptVector")),
SCRIPT_ITEM(CRSADecryptVectorCRT,_L8("RSADecryptVectorCRT")),
SCRIPT_ITEM(CRSASignVector,_L8("RSASignVector")),
SCRIPT_ITEM(CRSASignVectorCRT,_L8("RSASignVectorCRT")),
SCRIPT_ITEM(CRSAVerifyVector,_L8("RSAVerifyVector")),
SCRIPT_ITEM(CDSASignVector,_L8("DSASignVector")),
SCRIPT_ITEM(CDSAVerifyVector,_L8("DSAVerifyVector")),
SCRIPT_ITEM(CDSASignFB,_L8("DSASignFB")),
SCRIPT_ITEM(CDSAPrimeGen,_L8("DSAPrimeGen")),
SCRIPT_ITEM(CPerformanceTest, _L8("PerformanceTestSettings")),
SCRIPT_ITEM(CDHVector,_L8("DHVector")),
SCRIPT_ITEM(CRSATestPublicKey,_L8("RSAPublicKeyParams")),
SCRIPT_ITEM(CRSATestPrivateKey,_L8("RSAPrivateKeyParams")),
SCRIPT_ITEM(CRSATestPrivateKeyCRT,_L8("RSAPrivateKeyCRTParams"))
END_SCRIPT_LIST
// Either run the top level build and test script or, if running this test specifically,
// uncomment the following and it'll run them all one after the other
//get the system drive.
TDriveUnit sysDrive (RFs::GetSystemDrive());
TBuf<64> scriptFile = sysDrive.Name();
scriptFile.Append(_L("\\tasymmetric\\tasymmetrictests.txt"));
TBuf<64> logFile = sysDrive.Name();
logFile.Append(_L("\\tasymmetric\\tasymmetrictests.log"));
CTestSetup::CreateAndRunTestsL(theTestTypes, scriptFile, logFile);
/* The test framework can't handle more than one script
* at a time. If you want to run all of the asymmetric tests from the command
* line, uncomment this next section.
#ifndef _DEBUG
CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tasymmetric\\asymmetricPerformance.txt"),
_L("c:\\tasymmetric\\asymmetricPerformance.log"));
#endif
*/
}
示例8: SetDatabaseDriveL
/**
Set the current default Contacts database drive and optionally moves the
default Contacts database from the current default drive to the new drive.
@param aDriveUnit New current default Contacts database drive.
@param aCopy ETrue if default Contacts database should be moved to new drive.
*/
void CCntDbManagerController::SetDatabaseDriveL(TDriveUnit aDriveUnit, TBool aCopy)
{
if (aDriveUnit == iDefaultDriveUnit) // Same drive?
{
aCopy = EFalse;
if (iIniFileManager->DatabaseDriveSet())
{
return;
}
}
// Old drive name.
TDriveName oldDrv = iDefaultDriveUnit.Name();
// New drive name.
TDriveName newDrv = aDriveUnit.Name();
TBuf<KCntMaxFilePath> oldPath;
User::LeaveIfError(iFs.PrivatePath(oldPath));
// Drive name goes before the path.
oldPath.Insert(0,oldDrv);
// Filename goes after the path.
oldPath.Append(KSqLiteFilePrefix);
oldPath.Append(KContactsBaseFilename);
TBuf<KCntMaxFilePath> newPath;
User::LeaveIfError(iFs.PrivatePath(newPath));
// Drive name goes before the path.
newPath.Insert(0,newDrv);
// Filename goes after the path.
newPath.Append(KSqLiteFilePrefix);
newPath.Append(KContactsBaseFilename);
// Move the old file to the new drive location.
CFileMan* fileManager = CFileMan::NewL(iFs);
CleanupStack::PushL(fileManager);
// The new file will be overwritten if it exists. If the file or the path
// doesn't exist then it will be created.
if (aCopy)
{
User::LeaveIfError(fileManager->Copy(oldPath, newPath, CFileMan::ERecurse | CFileMan::EOverWrite ));
}
// Change the default drive to the specified drive.
iDefaultDriveUnit = aDriveUnit;
// Save to Contacts initialisation file.
iIniFileManager->SetDefaultDatabaseDrive(iDefaultDriveUnit, ETrue);
iIniFileManager->ScheduleSaveIniFileSettings(CIniFileManager::ESaveDefaultDbDrive);
// Remove the old file.
if (aCopy)
{
(void)fileManager->Delete(oldPath);
}
CleanupStack::PopAndDestroy(fileManager);
}
示例9: RunTestsL
void CWatcherActiveStep::RunTestsL()
{
switch (iTestState)
{
case EStateStartup: // Startup, test initial notify.
{
WaitForNotify();
iDriveWatcherX=CDriveWatcher::NewL(iFs, KDriveE, iWatcherStep);
break;
}
case EStateTestNotify: // Test notification which should apply to a watched drive
{
WaitForNotify();
GenerateMediaChangeL(_L("E:\\private\\10202DCE\\mediachange\\"));
break;
}
case EStateTestNotify2:
{
WaitForNotify();
TRAPD(err, GenerateMediaChangeL(_L("A:\\private\\10202DCE\\mediachange\\")));
if (err!=KErrNotReady && err!=KErrNone)
{
User::Leave(err);
}
TRAP(err, GenerateMediaChangeL(_L("B:\\private\\10202DCE\\mediachange\\")));
if (err!=KErrNotReady && err!=KErrNone)
{
User::Leave(err);
}
_LIT(KPath ,"\\private\\10202DCE\\mediachange\\");
TDriveUnit sysDrive (RFs::GetSystemDrive());
TBuf<128> mediaChangePath (sysDrive.Name());
mediaChangePath.Append(KPath);
TRAP(err, GenerateMediaChangeL(mediaChangePath));
if (err!=KErrNotReady && err!=KErrNone)
{
User::Leave(err);
}
TRAP(err, GenerateMediaChangeL(_L("D:\\private\\10202DCE\\mediachange\\")));
if (err!=KErrNotReady && err!=KErrNone)
{
User::Leave(err);
}
GenerateMediaChangeL(_L("E:\\private\\10202DCE\\mediachange\\"));
break;
}
}
}
示例10: TestBrokenStoreL
LOCAL_C void TestBrokenStoreL()
{
TDriveUnit unit =EDriveD;
TFileName dest = unit.Name();
dest.Append(KMsvDbFile);
RSqlDatabase::Delete(dest);
//Call Copy Mail Store to check any existing broken files are
//deleted first before copy begins
TestCopyStoreOperationL();
}
示例11: SetupMultipleLangResFilesL
void CTErrorStep::SetupMultipleLangResFilesL()
{
// Copy files to target path in C: drive
User::LeaveIfError(iUtils.CopyFileL(KTErrorLang1Src, KTErrorLang1Tgt));
User::LeaveIfError(iUtils.CopyFileL(KTErrorLang3Src, KTErrorLang3Tgt));
User::LeaveIfError(iUtils.CopyFileL(KTErrorLang6Src, KTErrorLang6Tgt));
// Find where the removable media is (can vary on hardware builds)
TDriveUnit drive;
FindRemovableMediaL(drive);
// Create target directory in removable drive
TBuf<128> bufName;
bufName = drive.Name();
bufName.Append(KTErrorLang2Tgt);
TInt err = iUtils.CreateDirectoryL(bufName);
if(err != KErrNone && err != KErrAlreadyExists)
{
ERR_PRINTF2(_L("Create directory '%S' in removable media failed"), &bufName);
User::LeaveIfError(err);
}
// Copy files to removable drive
User::LeaveIfError(iUtils.CopyFileL(KTErrorLang2Src, bufName));
bufName.Zero();
bufName = drive.Name();
bufName.Append(KTErrorLang4Tgt);
User::LeaveIfError(iUtils.CopyFileL(KTErrorLang4Src, bufName));
bufName.Zero();
bufName = drive.Name();
bufName.Append(KTErrorLang5Tgt);
User::LeaveIfError(iUtils.CopyFileL(KTErrorLang5Src, bufName));
bufName.Zero();
bufName = drive.Name();
bufName.Append(KTErrorLang7Tgt);
User::LeaveIfError(iUtils.CopyFileL(KTErrorLang7Src, bufName));
}
示例12: SetupAndRunTests
/**
* This function sets up a console, a log file and checks
* whether we need to wait for a key pressed after test
* completion.
* First DoThreadedTestsL is called, if everything is ok
* it return ETrue and we move on to the standard tests.
* If something went amiss (return EFalse) we skip
* the standard test and return.
*/
LOCAL_D void SetupAndRunTests()
{
CConsoleBase* console = Console::NewL(_L("Test code"), TSize(KConsFullScreen, KConsFullScreen));
HBufC* logFile = GetArgument(1);
if (logFile->Length()==0)
{
_LIT(defaultLog, "\\tcertstore.log");
TDriveUnit sysDrive (RFs::GetSystemDrive());
TDriveName sysdriveName (sysDrive.Name());
TBuf <18> fileName (sysdriveName);
fileName.Append(defaultLog);
logFile->ReAlloc(18);
TPtr16 plog = logFile->Des();
plog.Append(fileName);
}
HBufC* wait = GetArgument(2);
TBool waitAfterCompletion = EFalse;
if (wait->Find(_L("-w")) != KErrNotFound)
{
waitAfterCompletion = ETrue;
}
TBool res = EFalse;
TRAPD(err, res = DoThreadedTestsL(console, logFile, waitAfterCompletion));
if (res)
{
// Now run a normal tcertstore test to check store integrity
TRAP(err, DoTests());
}
delete console;
delete wait;
delete logFile;
}
示例13: InitialiseL
void TThreadData::InitialiseL(TInt aIteration, TInt aThreadNum)
{
ASSERT(aIteration >= 0 && aIteration < KMaxIterations);
ASSERT(aThreadNum >= 1 && aThreadNum <= 3);
TInt script = scriptCombinations[aIteration * 3 + aThreadNum - 1];
// Set script file
TDriveUnit sysDrive (RFs::GetSystemDrive());
TDriveName sysdriveName (sysDrive.Name());
TBuf <60> scriptFile (sysdriveName);
scriptFile.Append(scripts[script]);
iScriptFile.Set(scriptFile);
// Set log file
iLogFile.Zero();
TBuf<80> scriptName (sysdriveName);
scriptName.Append(_L("\\tcertstoreconcurrent\\iteration%02d_thread%d_script%d.txt"));
TBuf<80> buf ;
buf.Format(scriptName,aIteration, aThreadNum, script);
iLogFile.Append(buf);
}
示例14: ConvertFileToPrivateL
void CRecogStep::ConvertFileToPrivateL()
{
// Read source file
RFile fromFile;
User::LeaveIfError(fromFile.Open(iTheFs, iFileName, EFileShareReadersOrWriters | EFileRead | EFileStream));
CleanupClosePushL(fromFile);
TInt size;
User::LeaveIfError(fromFile.Size(size));
HBufC8* memForFileContents = HBufC8::NewLC(size);
TPtr8 fileContents(memForFileContents->Des());
User::LeaveIfError(fromFile.Read(fileContents, size));
// Create destination path
TDriveUnit sysDrive = RFs::GetSystemDrive();
(void)iTheFs.CreatePrivatePath(static_cast<TInt> (sysDrive));
TFileName newFileName;
User::LeaveIfError(iTheFs.PrivatePath(newFileName));
newFileName.Insert(0, sysDrive.Name());
TParsePtr parseFrom(iFileName);
newFileName.Append(parseFrom.NameAndExt());
// Make sure destination does not already exist.
(void) iTheFs.Delete(newFileName);
// Copy file to private location
RFile toFile;
User::LeaveIfError(toFile.Create(iTheFs, newFileName, EFileShareExclusive | EFileWrite | EFileStream));
CleanupClosePushL(toFile);
User::LeaveIfError(toFile.Write(fileContents));
// Update iFileName
iFileName = newFileName;
// Cleanup
CleanupStack::PopAndDestroy(&toFile);
CleanupStack::PopAndDestroy(memForFileContents);
CleanupStack::PopAndDestroy(&fromFile);
}
示例15: PerformAction
void CDeleteKeyStoreData::PerformAction(TRequestStatus& aStatus)
{
switch (iState)
{
case EDelete:
{
TDriveUnit sysDrive (RFs::GetSystemDrive());
TBuf<128> keystoreDataPath (sysDrive.Name());
keystoreDataPath.Append(KKeystoreDataPath);
TInt err = iFs.Delete(keystoreDataPath);
if (err == KErrNotFound)
err = KErrNone;
iState = EFinished;
TRequestStatus* status = &aStatus;
User::RequestComplete(status, err);
}
break;
case EFinished:
{
TRequestStatus* status = &aStatus;
User::RequestComplete(status, aStatus.Int());
if (aStatus == iExpectedResult)
{
iResult = ETrue;
}
else
{
iResult = EFalse;
}
iActionState = EPostrequisite;
}
break;
}
}