Volume System


Detailed Description

Volume access.


Classes

class  Torque::FS::FileBase
 Base class for all FileIO objects. More...
class  Torque::FS::FileNode
 Base class for objects in a FileSystem. More...
class  Torque::FS::File
 File object in a FileSystem. More...
class  Torque::FS::Directory
 Directory in a FileSystem. More...
class  Torque::FS::FileSystem
 Collection of FileNode objects. More...

File System Access

Functions for mounting file systems and dealing with files and directories. The kernel provides FileSystem mounting, the concept of a current working directory as well as relative paths.

bool Torque::FS::Mount (String root, FileSystemRef fs)
 Mount file system.
bool Torque::FS::Mount (String root, const Path &path)
 Mount file system redirect.
FileSystemRef Torque::FS::Unmount (String root)
 Remove mounted file system.
FileSystemRef Torque::FS::GetFileSystem (const Path &file)
 Find the the file system which owns the given file.
FileNodeRef Torque::FS::GetFileNode (const Path &path)
 Find the file system node for the given file.
S32 Torque::FS::FindByPattern (const Path &inBasePath, const String &inFilePattern, bool inRecursive, Vector< String > &outList)
 Find files matching a pattern starting in a given dir.
bool Torque::FS::SetCwd (const Path &file)
 Set current working directory.
const PathTorque::FS::GetCwd ()
 Get the current working directory.
bool Torque::FS::Remove (const Path &file)
 Remove (or delete) a file from the file system.
bool Torque::FS::Rename (const Path &from, const Path &to)
 Rename a file or directory.
bool Torque::FS::GetFileAttributes (const Path &path, FileNode::Attributes *attr)
 Get the file attributes.
FileRef Torque::FS::OpenFile (const Path &file, File::AccessMode mode)
 Open a file.
DirectoryRef Torque::FS::OpenDirectory (const Path &file)
 Open a directory.
FileRef Torque::FS::CreateFile (const Path &file)
 Create a file.
DirectoryRef Torque::FS::CreateDirectory (const Path &file)
 Create a directory.
bool Torque::FS::CreatePath (const Path &path)
 Create all the directories in the path if they don't already exist.
bool Torque::FS::MapFSPath (const String &inRoot, const Path &inPath, Path &outPath)
 Map a real file system path to a virtual one based on a root.
bool Torque::FS::ReadFile (const Path &inPath, void *&outData, U32 &outSize, bool inNullTerminate=false)
 Read in an entire file.
bool Torque::FS::IsReadOnly (const Path &path)
bool Torque::FS::IsDirectory (const Path &path)
bool Torque::FS::IsFile (const Path &path)
void Torque::FS::StartFileChangeNotifications ()
void Torque::FS::StopFileChangeNotifications ()
S32 Torque::FS::GetNumMounts ()
String Torque::FS::GetMountRoot (S32 index)
String Torque::FS::GetMountPath (S32 index)
String Torque::FS::GetMountType (S32 index)

Functions

String Torque::PathToPlatform (String file)
 Convert file/path name to use platform standard path separator.
String Torque::PathToOS (String file)
 Convert file/path name to use OS standard path separator.


Function Documentation

String Torque::PathToPlatform ( String  file  ) 

Convert file/path name to use platform standard path separator.

String Torque::PathToOS ( String  file  ) 

Convert file/path name to use OS standard path separator.

bool Torque::FS::Mount ( String  root,
FileSystemRef  fs 
)

Mount file system.

bool Torque::FS::Mount ( String  root,
const Path path 
)

Mount file system redirect.

FileSystemRef Torque::FS::Unmount ( String  root  ) 

Remove mounted file system.

The file system object associated with the given root is unmounted. Open files associated with this file system are unaffected.

Returns:
The unmounted file system.

FileSystemRef Torque::FS::GetFileSystem ( const Path file  ) 

Find the the file system which owns the given file.

FileNodeRef Torque::FS::GetFileNode ( const Path path  ) 

Find the file system node for the given file.

Returns:
Null if the file doesn't exist

S32 Torque::FS::FindByPattern ( const Path inBasePath,
const String inFilePattern,
bool  inRecursive,
Vector< String > &  outList 
)

Find files matching a pattern starting in a given dir.

Parameters:
inBasePath path to start in
inFilePattern the file pattern [it uses the FindMatch class]
inRecursive do we search recursively?
outList the list of files as Strings [Paths are more expensive to compute, so these may be converted on demand]
Returns:
number of files which matched

bool Torque::FS::SetCwd ( const Path file  ) 

Set current working directory.

const Path& Torque::FS::GetCwd (  ) 

Get the current working directory.

bool Torque::FS::Remove ( const Path file  ) 

Remove (or delete) a file from the file system.

bool Torque::FS::Rename ( const Path from,
const Path to 
)

Rename a file or directory.

bool Torque::FS::GetFileAttributes ( const Path path,
FileNode::Attributes *  attr 
)

Get the file attributes.

Returns:
success

FileRef Torque::FS::OpenFile ( const Path file,
File::AccessMode  mode 
)

Open a file.

If the file exists a file object will be returned even if the open operation fails.

Returns:
Null if the file does not exist

DirectoryRef Torque::FS::OpenDirectory ( const Path file  ) 

Open a directory.

If the directory exists a directory object will be returned even if the open operation fails.

Returns:
Null if the file does not exist

FileRef Torque::FS::CreateFile ( const Path file  ) 

Create a file.

The file object is returned in a closed state.

DirectoryRef Torque::FS::CreateDirectory ( const Path file  ) 

Create a directory.

The directory object is returned in a closed state.

bool Torque::FS::CreatePath ( const Path path  ) 

Create all the directories in the path if they don't already exist.

bool Torque::FS::MapFSPath ( const String inRoot,
const Path inPath,
Path outPath 
)

Map a real file system path to a virtual one based on a root.

This is useful when we get a real path back from an OS file dialog for example. e.g. If we have a root "gumby" which points at "C:/foo/bar", MapFSPath("gumby", "C:/foo/bar/blat/picture.png", path ); will map "C:/foo/bar/blat/picture.png" to "gumby:/blat/picture.png"

Parameters:
inRoot The root to check
inPath The real file system path
outPath The resulting volume system path
Returns:
Success or failure

bool Torque::FS::ReadFile ( const Path inPath,
void *&  outData,
U32 outSize,
bool  inNullTerminate = false 
)

Read in an entire file.

Note:
Caller is responsible for freeing memory
Parameters:
inPath the file
outData the pointer to return the data
outSize the size of the data returned
inNullTerminate add an extra '' byte to the return buffer
Returns:
successful read? If not, outData will be NULL and outSize will be 0

bool Torque::FS::IsReadOnly ( const Path path  ) 

bool Torque::FS::IsDirectory ( const Path path  ) 

bool Torque::FS::IsFile ( const Path path  ) 

void Torque::FS::StartFileChangeNotifications (  ) 

void Torque::FS::StopFileChangeNotifications (  ) 

S32 Torque::FS::GetNumMounts (  ) 

String Torque::FS::GetMountRoot ( S32  index  ) 

String Torque::FS::GetMountPath ( S32  index  ) 

String Torque::FS::GetMountType ( S32  index  )