Classes | |
| struct | DirListNode |
Functions | |
| std::vector< DirListNode > | GetDirListing (const std::string &pathstring) |
| bool | CreateDir (const std::string &path) |
| bool | PathExists (const std::string &path) |
| bool | IsPathAbsolute (const std::string &path) |
| bool | IsDir (const std::string &path) |
| bool | IsExecutable (const std::string &path) |
| bool | IsDirDelimiter (char c) |
| bool | RecursiveDelete (const std::string &path) |
| bool | DeleteSingleFileOrEmptyDirectory (const std::string &path) |
| std::string | TempPath () |
| Returns path to temp directory. | |
| std::string | CreateTempFile () |
| Returns path to securely-created temporary file (will already exist when this function returns). | |
| std::string | CreateTempDir () |
| Returns path to securely-created temporary directory (will already exist when this function returns). | |
| bool | CopyFileContents (const std::string &source, const std::string &target) |
| void | GetRecursiveDirs (std::vector< std::string > &dirs, const std::string &dir) |
| std::vector< std::string > | GetRecursiveDirs (const std::string &dir) |
| void | GetRecursiveSubPaths (const std::string &path, std::vector< std::string > &dst, bool list_files, const std::set< char > &ignore) |
| bool | RecursiveDeleteContent (const std::string &path) |
| bool | CreateAllDirs (const std::string &path) |
| bool | CopyDir (const std::string &source, const std::string &target) |
| bool | MoveDir (const std::string &source, const std::string &target) |
| bool | PathStartsWith (const std::string &path, const std::string &prefix) |
| std::string | RemoveLastPathComponent (const std::string &path, std::string *removed, int count) |
| std::string | RemoveRelativePathComponents (std::string path) |
| std::string | AbsolutePath (const std::string &path) |
| std::string | AbsolutePathPartial (const std::string &path) |
| const char * | GetFilenameFromPath (const char *path) |
| bool | safeWriteToFile (const std::string &path, std::string_view content) |
| bool | ReadFile (const std::string &path, std::string &out, bool log_error) |
| bool | Rename (const std::string &from, const std::string &to) |
| bool | OpenStream (std::filebuf &stream, const char *filename, std::ios::openmode mode, bool log_error, bool log_warn) |
Open a file buffer with error handling, commonly used with std::fstream.rdbuf(). | |
| bool | IsFile (const std::string &path) |
| std::string fs::AbsolutePath | ( | const std::string & | path | ) |
References PathExists().
Referenced by AbsolutePathPartial(), PauseMenuScripting::checkPathInternal(), ScriptApiSecurity::checkPathWithGamedef(), findSubgame(), getModsInPath(), ModApiMainMenu::l_get_modpaths(), and TestFileSys::testAbsolutePath().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string fs::AbsolutePathPartial | ( | const std::string & | path | ) |
References AbsolutePath(), DIR_DELIM, IsPathAbsolute(), RemoveLastPathComponent(), and RemoveRelativePathComponents().
Referenced by ScriptApiSecurity::checkPath(), ScriptApiSecurity::checkPathWithGamedef(), MainMenuScripting::mayModifyPath(), and TestFileSys::testAbsolutePath().
Here is the call graph for this function:
Here is the caller graph for this function:| bool fs::CopyDir | ( | const std::string & | source, |
| const std::string & | target ) |
References CopyDir(), CopyFileContents(), CreateAllDirs(), DIR_DELIM, GetDirListing(), and PathExists().
Referenced by CopyDir(), ModApiMainMenu::l_copy_dir(), ModApiUtil::l_cpdir(), and MoveDir().
Here is the call graph for this function:
Here is the caller graph for this function:| bool fs::CopyFileContents | ( | const std::string & | source, |
| const std::string & | target ) |
References errorstream, and tracestream.
Referenced by CopyDir(), TestFileSys::testCopyFileContents(), and FileCache::updateCopyFile().
Here is the caller graph for this function:| bool fs::CreateAllDirs | ( | const std::string & | path | ) |
References CreateDir(), PathExists(), and RemoveLastPathComponent().
Referenced by CopyDir(), create_userdata_path(), porting::createCacheDirTag(), FileCache::createDir(), ModStorageDatabaseFiles::endSave(), Client::initLocalMapSaving(), ModApiMainMenu::l_create_dir(), ModApiServer::l_get_mod_data_path(), ModApiUtil::l_mkdir(), loadGameConfAndInitWorld(), Database_SQLite3::openDatabase(), TestServerModManager::runTests(), and MapSettingsManager::saveMapMeta().
Here is the call graph for this function:
Here is the caller graph for this function:| bool fs::CreateDir | ( | const std::string & | path | ) |
Referenced by PlayerDatabaseFiles::PlayerDatabaseFiles(), Server::Server(), create_userdata_path(), CreateAllDirs(), Client::makeScreenshot(), ServerEnvironment::migratePlayersDatabase(), TestServerModManager::runTests(), PlayerDatabaseFiles::savePlayer(), TestFileSys::testAbsolutePath(), and TestFileSys::testRecursiveDelete().
Here is the caller graph for this function:| std::string fs::CreateTempDir | ( | ) |
Returns path to securely-created temporary directory (will already exist when this function returns).
References DIR_DELIM, and TempPath().
Referenced by TestBase::getTestTempDirectory(), and ModApiMainMenu::l_get_temp_path().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string fs::CreateTempFile | ( | ) |
Returns path to securely-created temporary file (will already exist when this function returns).
References DIR_DELIM, and TempPath().
Referenced by ModApiMainMenu::l_get_temp_path().
Here is the call graph for this function:
Here is the caller graph for this function:| bool fs::DeleteSingleFileOrEmptyDirectory | ( | const std::string & | path | ) |
References errorstream, and IsDir().
Referenced by Server::~Server(), GUIEngine::downloadFile(), ModApiUtil::l_rmdir(), ServerEnvironment::migratePlayersDatabase(), TestBan::reinitTestEnv(), PlayerDatabaseFiles::removePlayer(), TestAuthDatabase::runTests(), TestModStorageDatabase::runTests(), FileLogOutput::setFile(), Server::stepPendingDynMediaCallbacks(), and TestFileSys::testNonExist().
Here is the call graph for this function:
Here is the caller graph for this function:| std::vector< DirListNode > fs::GetDirListing | ( | const std::string & | pathstring | ) |
References fs::DirListNode::dir, and fs::DirListNode::name.
Referenced by ServerMap::ServerMap(), CopyDir(), Server::fillMediaCache(), getAvailableGameIds(), getAvailableWorlds(), getModsInPath(), GetRecursiveSubPaths(), ModApiUtil::l_get_dir_list(), ModStorageDatabaseFiles::listMods(), PlayerDatabaseFiles::listPlayers(), RecursiveDeleteContent(), and Client::scanModSubfolder().
Here is the caller graph for this function:| const char * fs::GetFilenameFromPath | ( | const char * | path | ) |
References DIR_DELIM_CHAR.
Referenced by ScriptApiSecurity::checkPathWithGamedef(), Server::dynamicAddMedia(), GUIEngine::getContentTranslations(), Server::init(), ModApiMainMenu::l_check_mod_configuration(), main(), and parseContentInfo().
Here is the caller graph for this function:| std::vector< std::string > fs::GetRecursiveDirs | ( | const std::string & | dir | ) |
| void fs::GetRecursiveDirs | ( | std::vector< std::string > & | dirs, |
| const std::string & | dir ) |
References dir(), GetRecursiveSubPaths(), and IsDir().
Referenced by Server::fillMediaCache(), ServerModManager::getModsMediaPaths(), GetRecursiveDirs(), getTextureDirs(), and Server::init().
Here is the call graph for this function:
Here is the caller graph for this function:| void fs::GetRecursiveSubPaths | ( | const std::string & | path, |
| std::vector< std::string > & | dst, | ||
| bool | list_files, | ||
| const std::set< char > & | ignore ) |
References DIR_DELIM, GetDirListing(), and GetRecursiveSubPaths().
Referenced by GetRecursiveDirs(), and GetRecursiveSubPaths().
Here is the call graph for this function:
Here is the caller graph for this function:| bool fs::IsDir | ( | const std::string & | path | ) |
Referenced by DeleteSingleFileOrEmptyDirectory(), ModStorageDatabaseFiles::endSave(), GetRecursiveDirs(), Client::initLocalMapSaving(), IsFile(), ModApiMainMenu::l_is_dir(), Client::migrateModStorage(), porting::open_directory(), TestFileSys::testNonExist(), and TestFileSys::testRecursiveDelete().
Here is the caller graph for this function:| bool fs::IsDirDelimiter | ( | char | c | ) |
Referenced by PathStartsWith(), RemoveLastPathComponent(), RemoveRelativePathComponents(), and TestFileSys::testIsDirDelimiter().
Here is the caller graph for this function:| bool fs::IsExecutable | ( | const std::string & | path | ) |
|
inline |
References IsDir(), and PathExists().
Referenced by getContentType(), sound::OpenALSoundManager::loadSoundFile(), sound::ProxySoundManager::loadSoundFile(), parseModContents(), TestBan::testCreate(), TestFileSys::testNonExist(), and TestFileSys::testRecursiveDelete().
Here is the call graph for this function:
Here is the caller graph for this function:| bool fs::IsPathAbsolute | ( | const std::string & | path | ) |
Referenced by AbsolutePathPartial(), ModConfiguration::addMods(), load_schematic(), Client::makeScreenshot(), and RecursiveDelete().
Here is the caller graph for this function:| bool fs::MoveDir | ( | const std::string & | source, |
| const std::string & | target ) |
References CopyDir(), errorstream, infostream, PathExists(), RecursiveDelete(), and Rename().
Referenced by ModApiMainMenu::l_copy_dir(), and ModApiUtil::l_mvdir().
Here is the call graph for this function:
Here is the caller graph for this function:| bool fs::OpenStream | ( | std::filebuf & | stream, |
| const char * | filename, | ||
| std::ios::openmode | mode, | ||
| bool | log_error, | ||
| bool | log_warn ) |
Open a file buffer with error handling, commonly used with std::fstream.rdbuf().
| stream | stream references, must not already be open |
| filename | filename to open |
| mode | mode bits (used as-is) |
| log_error | log failure to errorstream? |
| log_warn | log failure to warningstream? |
References errorstream, LAST_OS_ERROR, and warningstream.
Referenced by open_ifstream(), open_ofstream(), FileLogOutput::setFile(), and TestFileSys::testNonExist().
Here is the caller graph for this function:| bool fs::PathExists | ( | const std::string & | path | ) |
Referenced by ServerMap::ServerMap(), AbsolutePath(), CopyDir(), create_userdata_path(), CreateAllDirs(), porting::createCacheDirTag(), FileCache::exists(), findLocaleFileWithExtension(), findSubgame(), findWorldSubgame(), getAvailableWorlds(), getImagePath(), ModStorageDatabaseFiles::getOrCreateJson(), getShaderPath(), getWorldExists(), getWorldGameId(), RollbackManager::initDatabase(), porting::initializePaths(), IsFile(), ClientLauncher::launch_game(), loadGameConfAndInitWorld(), ServerEnvironment::loadMeta(), Client::makeScreenshot(), ServerEnvironment::migrateAuthDatabase(), porting::migrateCachePath(), MoveDir(), Database_SQLite3::openDatabase(), PlayerDatabaseFiles::savePlayer(), GUIEngine::setTexture(), TestMapSettingsManager::testMapMetaFailures(), and TestFileSys::testSafeWriteToFile().
Here is the caller graph for this function:| bool fs::PathStartsWith | ( | const std::string & | path, |
| const std::string & | prefix ) |
References FILESYS_CASE_INSENSITIVE, IsDirDelimiter(), and my_tolower().
Referenced by PauseMenuScripting::checkPathInternal(), ScriptApiSecurity::checkPathWithGamedef(), MainMenuScripting::mayModifyPath(), and TestFileSys::testPathStartsWith().
Here is the call graph for this function:
Here is the caller graph for this function:| bool fs::ReadFile | ( | const std::string & | path, |
| std::string & | out, | ||
| bool | log_error ) |
References open_ifstream().
Referenced by Server::addMediaFile(), GUIEngine::getContentTranslations(), Server::getTranslationLanguage(), irr::gui::SGUITTFace::loadFace(), parseContentInfo(), parseModContents(), read_translation_file(), SourceShaderCache::readFile(), ShadowRenderer::readShaderFile(), Client::scanModSubfolder(), Server::sendRequestedMedia(), TestFileSys::testCopyFileContents(), TestMapSettingsManager::testMapSettingsManager(), TestFileSys::testNonExist(), and TestFileSys::testSafeWriteToFile().
Here is the call graph for this function:
Here is the caller graph for this function:| bool fs::RecursiveDelete | ( | const std::string & | path | ) |
References errorstream, infostream, and IsPathAbsolute().
Referenced by ModApiMainMenu::l_delete_dir(), ModApiMainMenu::l_delete_world(), ModApiUtil::l_rmdir(), porting::migrateCachePath(), MoveDir(), RecursiveDeleteContent(), TestModStorageDatabase::runTests(), TestBase::testModule(), and TestFileSys::testRecursiveDelete().
Here is the call graph for this function:
Here is the caller graph for this function:| bool fs::RecursiveDeleteContent | ( | const std::string & | path | ) |
References DIR_DELIM, errorstream, GetDirListing(), infostream, RecursiveDelete(), and trim().
Here is the call graph for this function:| std::string fs::RemoveLastPathComponent | ( | const std::string & | path, |
| std::string * | removed, | ||
| int | count ) |
References DIR_DELIM, and IsDirDelimiter().
Referenced by AbsolutePathPartial(), CreateAllDirs(), MapSettingsManager::saveMapMeta(), TestFileSys::testRemoveLastPathComponent(), and TestFileSys::testRemoveLastPathComponentWithTrailingDelimiter().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string fs::RemoveRelativePathComponents | ( | std::string | path | ) |
References DIR_DELIM, and IsDirDelimiter().
Referenced by AbsolutePathPartial(), ModApiMainMenu::l_get_cache_path(), ModApiMainMenu::l_get_clientmodpath(), ModApiMainMenu::l_get_gamepath(), ModApiMainMenu::l_get_modpath(), ModApiMainMenu::l_get_modpaths(), ModApiMainMenu::l_get_texturepath(), ModApiMainMenu::l_get_texturepath_share(), ModApiMainMenu::l_get_user_path(), and TestFileSys::testRemoveRelativePathComponent().
Here is the call graph for this function:
Here is the caller graph for this function:| bool fs::Rename | ( | const std::string & | from, |
| const std::string & | to ) |
Referenced by ServerEnvironment::migrateAuthDatabase(), porting::migrateCachePath(), Client::migrateModStorage(), Server::migrateModStorageDatabase(), ServerEnvironment::migratePlayersDatabase(), MoveDir(), FileLogOutput::setFile(), and TestFileSys::testNonExist().
Here is the caller graph for this function:| bool fs::safeWriteToFile | ( | const std::string & | path, |
| std::string_view | content ) |
References errorstream, itos(), LAST_OS_ERROR, open_ofstream(), remove(), and sleep_ms.
Referenced by ModStorageDatabaseFiles::endSave(), ModApiUtil::l_safe_file_write(), LuaAreaStore::l_to_file(), BanManager::save(), ServerEnvironment::saveMeta(), PlayerDatabaseFiles::savePlayer(), Schematic::saveSchematicToFile(), TestFileSys::testSafeWriteToFile(), Settings::updateConfigFile(), and AuthDatabaseFiles::writeAuthFile().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string fs::TempPath | ( | ) |
Returns path to temp directory.
You probably don't want to use this directly, see CreateTempFile or CreateTempDir.
References DIR_DELIM, and porting::path_cache.
Referenced by CreateTempDir(), CreateTempFile(), and MainMenuScripting::mayModifyPath().
Here is the caller graph for this function: