#include <FileSystem.h>
Public Types | |
| typedef std::list< std::string > | FileList |
Public Member Functions | |
| FileSystem (bool noforcedvpaths=false) | |
| ~FileSystem () | |
| void | initBuiltinData (bool allowoverride) |
| IDataSource * | ReadFile (const std::string &vfn, bool is_text=false) |
| ODataSource * | WriteFile (const std::string &vfn, bool is_text=false) |
| bool | AddVirtualPath (const std::string &vpath, const std::string &realpath, bool create=false) |
| bool | RemoveVirtualPath (const std::string &vpath) |
| int | MkDir (const std::string &path) |
| int | ListFiles (const std::string mask, FileList &files) |
Static Public Member Functions | |
| static FileSystem * | get_instance () |
Private Member Functions | |
| void | switch_slashes (std::string &name) |
| bool | base_to_uppercase (std::string &str, int count) |
| bool | rawopen (std::ifstream &in, const std::string &fname, bool is_text=false) |
| bool | rawopen (std::ofstream &out, const std::string &fname, bool is_text=false) |
| bool | IsDir (const std::string &path) |
| bool | rewrite_virtual_path (std::string &vfn) |
| IDataSource * | checkBuiltinData (const std::string &vfn, bool is_text=false) |
Private Attributes | |
| bool | noforcedvpaths |
| bool | allowdataoverride |
| std::map< std::string, std::string > | virtualpaths |
| std::map< std::string, MemoryFile * > | memoryfiles |
Static Private Attributes | |
| static FileSystem * | filesystem = 0 |
Classes | |
| struct | MemoryFile |
Definition at line 32 of file FileSystem.h.
| typedef std::list<std::string> FileSystem::FileList |
Definition at line 73 of file FileSystem.h.
| FileSystem::FileSystem | ( | bool | noforcedvpaths = false |
) |
| noforcedvpaths | if false, all file operations must use vpaths |
Definition at line 43 of file FileSystem.cpp.
References AddVirtualPath(), con, filesystem, MM_INFO, and Console::Print().
| FileSystem::~FileSystem | ( | ) |
Definition at line 85 of file FileSystem.cpp.
References con, filesystem, MM_INFO, and Console::Print().
| bool FileSystem::AddVirtualPath | ( | const std::string & | vpath, | |
| const std::string & | realpath, | |||
| bool | create = false | |||
| ) |
Mount a virtual path
| vpath | the name of the vpath (should start with '@') | |
| realpath | the name of the path to mount (note that this can be a virtual path itself) | |
| create | create realpath directory if it doesn't exist? |
Referenced by GameDetector::detect(), FileSystem(), CoreApp::loadConfig(), CoreApp::setupGamePaths(), and CoreApp::setupVirtualPaths().
| bool FileSystem::base_to_uppercase | ( | std::string & | str, | |
| int | count | |||
| ) | [private] |
| IDataSource * FileSystem::checkBuiltinData | ( | const std::string & | vfn, | |
| bool | is_text = false | |||
| ) | [private] |
Check if the given file is a builtin data file. If so, return an IDataSource for it. If not, return 0.
Definition at line 370 of file FileSystem.cpp.
References memoryfiles.
| static FileSystem* FileSystem::get_instance | ( | ) | [inline, static] |
Definition at line 42 of file FileSystem.h.
References filesystem.
Referenced by choosePalette(), GameMapGump::ConCmd_dumpMap(), MovieGump::ConCmd_play(), FixedWidthFont::Create(), GameDetector::detect(), DirFile::exists(), DirFile::getObject(), DirFile::getSize(), GameData::getSpeechFlex(), FontManager::getTTF_Font(), PentagramMenuGump::InitGump(), U8SaveGump::loadDescriptions(), U8Game::loadFiles(), RemorseGame::loadFiles(), GameData::loadRemorseData(), GameData::loadU8Data(), U8Game::playCredits(), U8Game::playEndgameMovie(), U8Game::playIntroMovie(), U8Game::playQuotes(), DirFile::readMetadata(), U8Game::startGame(), ShapeViewerGump::U8ShapeViewer(), and INIFile::write().
| void FileSystem::initBuiltinData | ( | bool | allowoverride | ) |
Initialize builtin data files.
Definition at line 27 of file data.cpp.
References allowdataoverride, memoryfiles, and perr.
Referenced by GUIApp::startup().
| bool FileSystem::IsDir | ( | const std::string & | path | ) | [private] |
| int FileSystem::ListFiles | ( | const std::string | mask, | |
| FileList & | files | |||
| ) |
List files matching a mask
| mask | the mask to match | |
| files | the FileList to which the found files are appended | |
| return | OS-specific (FIXME!) |
Definition at line 96 of file ListFiles.h.
References perr, and rewrite_virtual_path().
Referenced by CompileUnit::CompileUnit(), and DirFile::readMetadata().
| int FileSystem::MkDir | ( | const std::string & | path | ) |
Create a directory
| path | the directory to create. (Can be virtual) |
Referenced by CoreApp::setupGamePaths().
| bool FileSystem::rawopen | ( | std::ofstream & | out, | |
| const std::string & | fname, | |||
| bool | is_text = false | |||
| ) | [private] |
| bool FileSystem::rawopen | ( | std::ifstream & | in, | |
| const std::string & | fname, | |||
| bool | is_text = false | |||
| ) | [private] |
| IDataSource* FileSystem::ReadFile | ( | const std::string & | vfn, | |
| bool | is_text = false | |||
| ) |
Open a file as readable. Streamed.
| vfn | the (virtual) filename | |
| is_text | open in text mode? |
Referenced by choosePalette(), MovieGump::ConCmd_play(), FixedWidthFont::Create(), GameDetector::detect(), DirFile::exists(), DirFile::getObject(), DirFile::getSize(), GameData::getSpeechFlex(), FontManager::getTTF_Font(), GUIApp::GraphicSysInit(), PentagramMenuGump::InitGump(), U8SaveGump::loadDescriptions(), U8Game::loadFiles(), RemorseGame::loadFiles(), GUIApp::loadGame(), GameData::loadRemorseData(), GameData::loadU8Data(), main(), CompileUnit::parse(), U8Game::playCredits(), U8Game::playEndgameMovie(), U8Game::playIntroMovie(), U8Game::playQuotes(), run(), U8Game::startGame(), and ShapeViewerGump::U8ShapeViewer().
| bool FileSystem::RemoveVirtualPath | ( | const std::string & | vpath | ) |
| bool FileSystem::rewrite_virtual_path | ( | std::string & | vfn | ) | [private] |
Referenced by ListFiles().
| void FileSystem::switch_slashes | ( | std::string & | name | ) | [private] |
| ODataSource* FileSystem::WriteFile | ( | const std::string & | vfn, | |
| bool | is_text = false | |||
| ) |
Open a file as writable. Streamed.
| vfn | the (virtual) filename | |
| is_text | open in text mode? |
Referenced by GameMapGump::ConCmd_dumpMap(), main(), GUIApp::saveGame(), and INIFile::write().
bool FileSystem::allowdataoverride [private] |
FileSystem * FileSystem::filesystem = 0 [static, private] |
Definition at line 101 of file FileSystem.h.
Referenced by FileSystem(), get_instance(), and ~FileSystem().
std::map<std::string, MemoryFile*> FileSystem::memoryfiles [private] |
Definition at line 127 of file FileSystem.h.
Referenced by checkBuiltinData(), and initBuiltinData().
bool FileSystem::noforcedvpaths [private] |
Definition at line 105 of file FileSystem.h.
std::map<std::string, std::string> FileSystem::virtualpaths [private] |
Definition at line 114 of file FileSystem.h.
1.4.7