Minetest  5.4.0
fs Namespace Reference

Classes

struct  DirListNode
 

Functions

std::vector< DirListNodeGetDirListing (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 IsDirDelimiter (char c)
 
bool RecursiveDelete (const std::string &path)
 
bool DeleteSingleFileOrEmptyDirectory (const std::string &path)
 
std::string TempPath ()
 
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 CopyFileContents (const std::string &source, const std::string &target)
 
bool CopyDir (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)
 
const char * GetFilenameFromPath (const char *path)
 
bool safeWriteToFile (const std::string &path, const std::string &content)
 
bool ReadFile (const std::string &path, std::string &out)
 
bool Rename (const std::string &from, const std::string &to)
 

Function Documentation

◆ AbsolutePath()

std::string fs::AbsolutePath ( const std::string &  path)

Referenced by ScriptApiSecurity::checkPath().

+ Here is the caller graph for this function:

◆ CopyDir()

bool fs::CopyDir ( const std::string &  source,
const std::string &  target 
)

References CopyFileContents(), CreateAllDirs(), DIR_DELIM, GetDirListing(), and PathExists().

Referenced by ModApiMainMenu::l_copy_dir().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CopyFileContents()

bool fs::CopyFileContents ( const std::string &  source,
const std::string &  target 
)

References errorstream, and infostream.

Referenced by CopyDir().

+ Here is the caller graph for this function:

◆ CreateAllDirs()

bool fs::CreateAllDirs ( const std::string &  path)

References CreateDir(), PathExists(), and RemoveLastPathComponent().

Referenced by CopyDir(), ClientMediaDownloader::initialStep(), Client::initLocalMapSaving(), ModApiMainMenu::l_create_dir(), ModApiMainMenu::l_extract_zip(), ModApiUtil::l_mkdir(), loadGameConfAndInitWorld(), Database_SQLite3::openDatabase(), ModMetadata::save(), and MapSettingsManager::saveMapMeta().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateDir()

bool fs::CreateDir ( const std::string &  path)

Referenced by PlayerDatabaseFiles::PlayerDatabaseFiles(), create_userdata_path(), CreateAllDirs(), TestBase::getTestTempDirectory(), Client::makeScreenshot(), ServerEnvironment::migratePlayersDatabase(), and PlayerDatabaseFiles::savePlayer().

+ Here is the caller graph for this function:

◆ DeleteSingleFileOrEmptyDirectory()

bool fs::DeleteSingleFileOrEmptyDirectory ( const std::string &  path)

References errorstream, and IsDir().

Referenced by RollbackManager::RollbackManager(), GUIEngine::downloadFile(), ServerEnvironment::migratePlayersDatabase(), TestBan::reinitTestEnv(), PlayerDatabaseFiles::removePlayer(), and TestAuthDatabase::runTests().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetDirListing()

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(), PlayerDatabaseFiles::listPlayers(), RecursiveDeleteContent(), and Client::scanModSubfolder().

+ Here is the caller graph for this function:

◆ GetFilenameFromPath()

const char * fs::GetFilenameFromPath ( const char *  path)

References DIR_DELIM_CHAR.

Referenced by Server::dynamicAddMedia(), and Server::init().

+ Here is the caller graph for this function:

◆ GetRecursiveDirs() [1/2]

std::vector< std::string > fs::GetRecursiveDirs ( const std::string &  dir)

References dir(), and GetRecursiveDirs().

+ Here is the call graph for this function:

◆ GetRecursiveDirs() [2/2]

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:

◆ GetRecursiveSubPaths()

void fs::GetRecursiveSubPaths ( const std::string &  path,
std::vector< std::string > &  dst,
bool  list_files,
const std::set< char > &  ignore 
)

References DIR_DELIM, and GetDirListing().

Referenced by GetRecursiveDirs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsDir()

bool fs::IsDir ( const std::string &  path)

Referenced by DeleteSingleFileOrEmptyDirectory(), GetRecursiveDirs(), Client::initLocalMapSaving(), ModApiMainMenu::l_is_dir(), porting::open_directory(), and ModMetadata::save().

+ Here is the caller graph for this function:

◆ IsDirDelimiter()

bool fs::IsDirDelimiter ( char  c)

Referenced by PathStartsWith(), RemoveLastPathComponent(), RemoveRelativePathComponents(), and TestFilePath::testIsDirDelimiter().

+ Here is the caller graph for this function:

◆ IsPathAbsolute()

bool fs::IsPathAbsolute ( const std::string &  path)

Referenced by load_schematic(), and Client::makeScreenshot().

+ Here is the caller graph for this function:

◆ PathExists()

◆ PathStartsWith()

bool fs::PathStartsWith ( const std::string &  path,
const std::string &  prefix 
)

References FILESYS_CASE_INSENSITIVE, and IsDirDelimiter().

Referenced by ScriptApiSecurity::checkPath(), ModApiMainMenu::mayModifyPath(), and TestFilePath::testPathStartsWith().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ReadFile()

bool fs::ReadFile ( const std::string &  path,
std::string &  out 
)

Referenced by Server::addMediaFile(), Server::getTranslationLanguage(), Client::scanModSubfolder(), and TestMapSettingsManager::testMapSettingsManager().

+ Here is the caller graph for this function:

◆ RecursiveDelete()

bool fs::RecursiveDelete ( const std::string &  path)

References infostream, and verbosestream.

Referenced by ModApiMainMenu::l_copy_dir(), ModApiMainMenu::l_delete_dir(), ModApiMainMenu::l_delete_world(), porting::migrateCachePath(), RecursiveDeleteContent(), and TestBase::testModule().

+ Here is the caller graph for this function:

◆ RecursiveDeleteContent()

bool fs::RecursiveDeleteContent ( const std::string &  path)

References DIR_DELIM, errorstream, GetDirListing(), infostream, RecursiveDelete(), and trim().

+ Here is the call graph for this function:

◆ RemoveLastPathComponent()

std::string fs::RemoveLastPathComponent ( const std::string &  path,
std::string *  removed,
int  count 
)

References DIR_DELIM, and IsDirDelimiter().

Referenced by ScriptApiSecurity::checkPath(), CreateAllDirs(), ModApiMainMenu::l_extract_zip(), MapSettingsManager::saveMapMeta(), TestFilePath::testRemoveLastPathComponent(), and TestFilePath::testRemoveLastPathComponentWithTrailingDelimiter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RemoveRelativePathComponents()

std::string fs::RemoveRelativePathComponents ( std::string  path)

References DIR_DELIM, and IsDirDelimiter().

Referenced by ModApiMainMenu::l_copy_dir(), ModApiMainMenu::l_delete_dir(), ModApiMainMenu::l_download_file(), ModApiMainMenu::l_extract_zip(), ModApiMainMenu::l_get_cache_path(), ModApiMainMenu::l_get_clientmodpath(), ModApiMainMenu::l_get_gamepath(), ModApiMainMenu::l_get_modpath(), ModApiMainMenu::l_get_texturepath(), ModApiMainMenu::l_get_texturepath_share(), ModApiMainMenu::l_get_user_path(), ModApiMainMenu::l_may_modify_path(), ModApiMainMenu::mayModifyPath(), and TestFilePath::testRemoveRelativePathComponent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Rename()

bool fs::Rename ( const std::string &  from,
const std::string &  to 
)

Referenced by ServerEnvironment::migrateAuthDatabase(), porting::migrateCachePath(), and ServerEnvironment::migratePlayersDatabase().

+ Here is the caller graph for this function:

◆ safeWriteToFile()

bool fs::safeWriteToFile ( const std::string &  path,
const std::string &  content 
)

References sleep_ms, and warningstream.

Referenced by ModApiUtil::l_safe_file_write(), LuaAreaStore::l_to_file(), loadGameConfAndInitWorld(), BanManager::save(), ModMetadata::save(), ServerEnvironment::saveMeta(), PlayerDatabaseFiles::savePlayer(), Schematic::saveSchematicToFile(), Settings::updateConfigFile(), and AuthDatabaseFiles::writeAuthFile().

+ Here is the caller graph for this function:

◆ TempPath()

std::string fs::TempPath ( )

References DIR_DELIM, and porting::path_cache.

Referenced by TestBase::getTestTempDirectory(), ModApiMainMenu::l_get_temp_path(), and ModApiMainMenu::mayModifyPath().

+ Here is the caller graph for this function: