/****************************************************************************** * TMFSHook.cpp - description * ------------------- * begin : 2005/04/20 * copyright : (C) 2005 by Harald K. Strack * copyright : (C) 2005 by Trymedia Inc. * email : hstrack@trymedia.com, strack@fhm.edu ****************************************************************************** * changes name date comment */ /* TMFSHook: Trymedia FileSystem Hook * * This is an Adaptor (Wrapper) to hook P4's filesystem calls. * It only hooks (hopefully) calls for versioned files. Temporary files * are not hooked (see TMFSHook::CreateTemp()). * * It mainly does nothing, but if you need to add funcionality * to a filesytem call (like disabling Chmod(), ...) * you can do this in here or the header file. * This class is used by every TMClientUser and its subclasses. * * */ #include "TMFSHook.h" /* Create a "real (p4) FileSys * */ TMFSHook * TMFSHook::Create( FileSysType type ) { TMFSHook * tmp = new TMFSHook(); tmp->realFS = FileSys::Create (type); return tmp; } /* Do not use this directly */ TMFSHook::TMFSHook() : FileSys() { tmbo = NULL; } TMFSHook::~TMFSHook() { delete this->realFS; } void TMFSHook::Open( FileOpenMode mode, Error *e ) { realFS->Open(mode,e); //Hook for submit if (this->tmbo != NULL && this->tmbo->GetType() == SUBMIT_HANDLER) { this->tmbo->SetFileSys(realFS); } // printf( "In TMFSHook::Open()\n" ); } void TMFSHook::Write( const char *buf, int len, Error *e ) { realFS->Write(buf,len,e); } int TMFSHook::Read( char *buf, int len, Error *e ) { int tmp = realFS->Read(buf,len,e); return tmp; } int TMFSHook::ReadLine( StrBuf *buf, Error *e ) { int tmp = realFS->ReadLine(buf,e); return tmp; } void TMFSHook::Close( Error *e ) { realFS->Close(e); } int TMFSHook::Stat() { int tmp = realFS->Stat(); return tmp; } int TMFSHook::StatModTime() { int tmp = realFS->StatModTime(); return tmp; } void TMFSHook::Truncate( Error *e ) { realFS->Truncate(e); } void TMFSHook::Unlink( Error *e = 0 ) { realFS->Unlink(e); } void TMFSHook::Rename( FileSys *target, Error *e ) { realFS->Rename(target,e); } /* Hooked out for p4 edit, add, revert, sync, submit */ void TMFSHook::Chmod( FilePerm perms, Error *e ) { //realFS->Chmod(perms,e); } void TMFSHook::ChmodTime( Error *e ) { realFS->ChmodTime(e); }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#5 | 5056 | harald_strack |
Directory support. Serious bug concerned to not unzipped binaries removed. Some other small bugfixes. |
||
#4 | 4980 | harald_strack |
Since I am maintaining the stuff in a local repository, I did some copy errors in the last revisions. Fixed. |
||
#3 | 4978 | harald_strack |
ap4 integrate implemented. Octal format is now used to save permissions. NOT backwards compatible anymore!!! |
||
#2 | 4975 | harald_strack |
Permissions are now masked to 555, so no write is possible. If you edit the Makefile and give the parameter -DFULL_PERMS, you have the old behaviour. Bugfix in ap4 revert: Edited and changed files were not reverted correctly. |
||
#1 | 4948 | harald_strack | Initial revision. |