FArchive* FFileManagerGeneric::CreateFileWriter( const TCHAR* Filename, uint32 Flags ) { // Only allow writes to files that are not signed // Except if the file is missing( that way corrupt ini files can be autogenerated by deleting them ) if( FSHA1::GetFileSHAHash( Filename, NULL ) && FileSize( Filename ) != -1 ) { UE_LOG( LogFileManager, Log, TEXT( "Can't write to signed game file: %s" ),Filename ); return new FArchiveFileWriterDummy(); } MakeDirectory( *FPaths::GetPath(Filename), true ); if( Flags & FILEWRITE_EvenIfReadOnly ) { GetLowLevel().SetReadOnly( Filename, false ); } IFileHandle* Handle = GetLowLevel().OpenWrite( Filename, !!( Flags & FILEWRITE_Append ), !!( Flags & FILEWRITE_AllowRead ) ); if( !Handle ) { if( Flags & FILEWRITE_NoFail ) { UE_LOG( LogFileManager, Fatal, TEXT( "Failed to create file: %s" ), Filename ); } return NULL; } return new FArchiveFileWriterGeneric( Handle, Filename, Handle->Tell() ); }
void FNetworkFileServerClientConnection::ProcessSeekFile( FArchive& In, FArchive& Out ) { // Get Handle ID uint64 HandleId = 0; In << HandleId; int64 NewPosition; In << NewPosition; int64 SetPosition = -1; IFileHandle* File = FindOpenFile(HandleId); if (File && File->Seek(NewPosition)) { SetPosition = File->Tell(); } Out << SetPosition; }