void CPreModifierPlugin::FsRenameL(TFsPluginRequest& aRequest) { TInt err = KErrNone; TFileName oldfilename; TFileName newfilename; oldfilename = aRequest.Src().FullName(); newfilename = aRequest.Dest().FullName(); TBuf<256> testfilename1; //setting up test files testfilename1.Append(iDriveToTest); testfilename1.Append(_L(":\\Data\\test.txt")); if (aRequest.IsPostOperation()) { _LOG(_L("CPreModifierPlugin::FsRenameL, post intercept")); RFilePlugin fileplugin2(aRequest); //open a second file err = fileplugin2.Open(testfilename1, EFileWrite); _LOG3(_L("CPreModifierPlugin::FsRenameL, RFilePlugin::Open for %S returned %d"), &testfilename1, err); iLastError = err; iLineNumber = __LINE__; if(err!=KErrNone) User::Leave(err); //trapped in DoRequestL TInt64 size=0; err = fileplugin2.Size(size); iLastError = err; iLineNumber = __LINE__; if(err!=KErrNone) User::Leave(err); //trapped in DoRequestL //close the second file fileplugin2.Close(); _LOG2(_L("CPreModifierPlugin::FsRenameL, RFilePlugin::Close to the second file returned %d"), err); } else { User::Invariant(); } }
/** @internalComponent */ void CPreModifierPlugin::FsFileRenameL(TFsPluginRequest& aRequest) { TFileName oldfilename, newfilename; TParse parse; oldfilename = aRequest.Src().FullName(); newfilename = aRequest.Dest().FullName(); parse.Set(oldfilename, NULL, NULL); TPtrC extension(parse.Ext()); _LOG3(_L("CPreModifierPlugin::FsFileRenameL, old name: %S, new name: %S"), &oldfilename, &newfilename); if (aRequest.IsPostOperation()) { _LOG(_L("CPreModifierPlugin::FsFileRenameL, post intercept")); if (extension.CompareF(_L(".tst")) == 0) { TBuf8<32> tempBuf = (_L8("Rename Post Intercept")); RFilePlugin fileplugin(aRequest); TInt err = fileplugin.AdoptFromClient(); iLastError = err; iLineNumber = __LINE__; if(err!=KErrNone) User::Leave(err); //trapped in DoRequestL err = fileplugin.Write(20, tempBuf); _LOG2(_L("CPreModifierPlugin::FsFileRenameL, FileWrite returned %d"), err); iLastError = err; iLineNumber = __LINE__; if(err!=KErrNone) User::Leave(err); //trapped in DoRequestL fileplugin.Close(); } } else { User::Invariant(); } }
void CPreModifierPlugin::FsReplaceL(TFsPluginRequest& aRequest) { TFileName oldfilename; TFileName newfilename; oldfilename = aRequest.Src().FullName(); newfilename = aRequest.Dest().FullName(); TBuf<256> testfilename1; //setting up test files testfilename1.Append(iDriveToTest); testfilename1.Append(_L(":\\Data\\test.txt")); if (aRequest.IsPostOperation()) { //STF: Is this code going to get called - the pre-operation completes early? _LOG(_L("CPreModifierPlugin::FsReplaceL, post intercept")); //We should check that the name has changed here. RFilePlugin file(aRequest); TInt err = file.AdoptFromClient(); iLastError = err; iLineNumber = __LINE__; if(err!=KErrNone) User::Leave(err); //trapped in DoRequestL TInt compare = oldfilename.Compare(newfilename); if(compare != 0) //is equal { //User::Leave(compare); //It wont be equal as the name is coming from the request aint it. //Pointless comparison then eh? } file.Close(); RFilePlugin fileplugin2(aRequest); //open a second file err = fileplugin2.Open(testfilename1, EFileWrite); _LOG3(_L("CPreModifierPlugin::FsReplaceL, RFilePlugin::Open for %S returned %d"), &testfilename1, err); iLastError = err; iLineNumber = __LINE__; if(err!=KErrNone) User::Leave(err); //trapped in DoRequestL TInt64 size=0; err =fileplugin2.Size(size); iLastError = err; iLineNumber = __LINE__; if(err!=KErrNone) User::Leave(err); //trapped in DoRequestL //close the second file fileplugin2.Close(); _LOG2(_L("CPreModifierPlugin::FsReplaceL, RFilePlugin::Close to the second file returned %d"), err); } else { User::Invariant(); } }