Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

iVFS Struct Reference

The Virtual Filesystem Class is intended to be the only way for Crystal Space engine to access the files. More...

#include <vfs.h>

Inheritance diagram for iVFS:

iBase List of all members.

Public Methods

virtual bool ChDir (const char *Path)=0
 Set current working directory.

virtual const char* GetCwd () const=0
 Get current working directory.

virtual void PushDir ()=0
 Push current directory.

virtual bool PopDir ()=0
 Pop current directory.

virtual iDataBufferExpandPath (const char *Path, bool IsDir=false) const=0
 Expand given virtual path, interpret all "." and ".."'s relative to 'currend virtual directory'. More...

virtual bool Exists (const char *Path) const=0
 Check whenever a file exists.

virtual iStrVectorFindFiles (const char *Path) const=0
 Find all files in a virtual directory and return an array with their names.

virtual iFileOpen (const char *FileName, int Mode)=0
 Replacement for standard fopen().

virtual iDataBufferReadFile (const char *FileName)=0
 Get an entire file at once. More...

virtual bool WriteFile (const char *Name, const char *Data, size_t Size)=0
 Write an entire file in one pass.

virtual bool DeleteFile (const char *FileName)=0
 Delete a file on VFS.

virtual bool Sync ()=0
 Close all opened archives, free temporary storage etc.

virtual bool Mount (const char *VirtualPath, const char *RealPath)=0
 Mount an VFS path on a "real-world-filesystem" path.

virtual bool Unmount (const char *VirtualPath, const char *RealPath)=0
 Unmount an VFS path; if RealPath is NULL, entire VirtualPath is unmounted.

virtual bool SaveMounts (const char *FileName)=0
 Save current configuration back into configuration file.

virtual bool GetFileTime (const char *FileName, csFileTime &oTime) const=0
 Query file date/time.

virtual bool SetFileTime (const char *FileName, const csFileTime &iTime)=0
 Set file date/time.

virtual bool GetFileSize (const char *FileName, size_t &oSize)=0
 Query file size (without opening it).

virtual iDataBufferGetRealPath (const char *FileName)=0
 Query real-world path from given VFS path. More...


Detailed Description

The Virtual Filesystem Class is intended to be the only way for Crystal Space engine to access the files.

This gives unified control over the way how files are found, read and written. VFS gives the following goodies over the standard file i/o functions:

  • Multiple search directories. Several "real" directories can be collected together into one "virtual" directory.
  • Directories can be mapped to "real" directories as well as to archives (.zip files). Files are compressed/decompressed transparently for clients.
  • The Virtual File System is unique across all operating systems Crystal Space supports, no matter of features of the underlying OS.
This class has only most basic features of a real filesystem: file reading and writing (no simultaneous read and write mode are allowed because it would be rather complex to implement it for archives). However, most programs don't even need such functionality, and for sure Crystal Space itself doesn't need it. Files open for writing are always truncated. A simple meaning for getting a list of files in a virtual directory is implemented; however the user is presented with only a list of file names; no fancy things like file size, time etc (file size can be determined after opening it for reading).


Member Function Documentation

iDataBuffer * iVFS::ExpandPath ( const char * Path,
bool IsDir = false ) const [pure virtual]
 

Expand given virtual path, interpret all "." and ".."'s relative to 'currend virtual directory'.

Return a new iString object. If IsDir is true, expanded path ends in an '/', otherwise no.

iDataBuffer * iVFS::GetRealPath ( const char * FileName ) [pure virtual]
 

Query real-world path from given VFS path.

This will work only for files that are stored on real filesystem, not in archive files. You should expect this function to return NULL in this case.

iDataBuffer * iVFS::ReadFile ( const char * FileName ) [pure virtual]
 

Get an entire file at once.

You should DecRef() returned data after usage. This is more effective than opening files and reading the file in blocks. Note that the returned buffer is always null- terminated (so that it can be conveniently used with string functions) but the extra null-terminator is not counted as part of the returned size.


The documentation for this struct was generated from the following file:
Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000