ezEngine  Milestone 7
ezDataDirectory::FolderType Class Reference

A data directory type to handle access to ordinary files. More...

#include <DataDirTypeFolder.h>

Inheritance diagram for ezDataDirectory::FolderType:

Public Member Functions

virtual void ReloadExternalConfigs () override
 Some data directory types may use external configuration files (e.g. asset lookup tables) that may get updated, while the directory is mounted. This function allows each directory type to implement reloading and reapplying of configurations, without dismounting and remounting the data directory.
 
- Public Member Functions inherited from ezDataDirectoryType
const ezString128GetDataDirectoryPath () const
 Returns the absolute path to the data directory.
 

Static Public Member Functions

static ezDataDirectoryTypeFactory (const char *szDataDirectory)
 The factory that can be registered at ezFileSystem to create data directories of this type.
 

Static Public Attributes

static ezString s_sRedirectionFile
 
static ezString s_sRedirectionPrefix
 If a redirection file is used AND the redirection lookup was successful, s_sRedirectionPrefix is prepended to the redirected file access.
 

Protected Member Functions

virtual ezDataDirectoryReaderOpenFileToRead (const char *szFile) override
 Must be implemented to create a ezDataDirectoryReader for accessing the given file. Returns nullptr if the file could not be opened.
 
virtual ezDataDirectoryWriterOpenFileToWrite (const char *szFile) override
 Must be implemented to create a ezDataDirectoryWriter for accessing the given file. Returns nullptr if the file could not be opened. More...
 
virtual void RemoveDataDirectory () override
 This function is called by the filesystem when a data directory is removed. More...
 
virtual void DeleteFile (const char *szFile) override
 If a Data Directory Type supports it, this function will remove the given file from it.
 
- Protected Member Functions inherited from ezDataDirectoryType
ezResult InitializeDataDirectory (const char *szDataDirPath)
 Tries to setup the data directory. Can fail, if the type is incorrect (e.g. a ZIP file data directory type cannot handle a simple folder and vice versa)
 
virtual bool ExistsFile (const char *szFile)
 This function checks whether the given file exists in this data directory. More...
 

Private Member Functions

virtual ezResult InternalInitializeDataDirectory (const char *szDirectory) override
 Called by 'ezDataDirectoryType_Folder::Factory'.
 
virtual void OnReaderWriterClose (ezDataDirectoryReaderWriterBase *pClosed) override
 Marks the given reader/writer as reusable.
 
void LoadRedirectionFile ()
 

Private Attributes

ezHybridArray
< ezDataDirectory::FolderReader *, 4 > 
m_Readers
 
ezHybridArray
< ezDataDirectory::FolderWriter *, 4 > 
m_Writers
 
ezMap< ezString, ezStringm_FileRedirection
 

Detailed Description

A data directory type to handle access to ordinary files.

Register the 'Factory' function at ezFileSystem to allow it to mount local directories.

Member Function Documentation

ezDataDirectoryWriter * ezDataDirectory::FolderType::OpenFileToWrite ( const char *  szFile)
overrideprotectedvirtual

Must be implemented to create a ezDataDirectoryWriter for accessing the given file. Returns nullptr if the file could not be opened.

If it always returns nullptr (default) the data directory is read-only (at least through this type).

Reimplemented from ezDataDirectoryType.

void ezDataDirectory::FolderType::RemoveDataDirectory ( )
overrideprotectedvirtual

This function is called by the filesystem when a data directory is removed.

It should delete itself using the proper allocator.

Implements ezDataDirectoryType.

Member Data Documentation

ezString ezDataDirectory::FolderType::s_sRedirectionFile
static

A 'redirection file' is an optional file located inside a data directory that lists which file access is redirected to which other file lookup. Each redirection is one line in the file (terminated by a
). Each line consists of the 'key' string, a semicolon and a 'value' string. No unnecessary whitespace is allowed. When a file that matches 'key' is accessed through a mounted data directory, the file access will be replaced by 'value' (plus s_sRedirectionPrefix) 'key' may be anything (e.g. a GUID string), 'value' should be a valid relative path into the SAME data directory. The redirection file can be used to implement an asset lookup, where assets are identified by GUIDs and need to be mapped to the actual asset file.


The documentation for this class was generated from the following files: