OpenTTD Source
20240917-master-g9ab0a47812
|
Go to the documentation of this file.
16 std::optional<FileHandle>
FioFOpenFile(
const std::string &filename,
const char *mode,
Subdirectory subdir,
size_t *filesize =
nullptr);
22 bool FioRemove(
const std::string &filename);
29 std::unique_ptr<char[]>
ReadFileToMem(
const std::string &filename,
size_t &lenp,
size_t maxsize);
34 extern std::vector<Searchpath> _valid_searchpaths;
44 uint
Scan(std::string_view extension,
Subdirectory sd,
bool tars =
true,
bool recursive =
true);
45 uint
Scan(std::string_view extension,
const std::string &directory,
bool recursive =
true);
55 virtual bool AddFile(
const std::string &filename,
size_t basepath_length,
const std::string &tar_filename) = 0;
73 bool AddFile(
const std::string &filename,
size_t basepath_length,
const std::string &tar_filename = {})
override;
@ ALL
Scan for everything.
uint DoScan(Subdirectory sd)
Perform the scanning of a particular subdirectory.
void FioCreateDirectory(const std::string &name)
Create a directory with the given name If the parent directory does not exist, it will try to create ...
Searchpath
Types of searchpaths OpenTTD might use.
bool FioRemove(const std::string &filename)
Remove a file.
bool FioCheckFileExists(const std::string &filename, Subdirectory subdir)
Check whether the given file exists.
void AppendPathSeparator(std::string &buf)
Appends, if necessary, the path separator character to the end of the string.
void SanitizeFilename(std::string &filename)
Sanitizes a filename, i.e.
virtual bool AddFile(const std::string &filename, size_t basepath_length, const std::string &tar_filename)=0
Add a file with the given filename.
Subdirectory subdir
The current sub directory we are searching through.
@ NEWGRF
Scan for non-base sets.
std::unique_ptr< char[]> ReadFileToMem(const std::string &filename, size_t &lenp, size_t maxsize)
Load a file into memory.
@ GAME
Scan for game scripts.
bool AddFile(const std::string &filename, size_t basepath_length, const std::string &tar_filename={}) override
Add a file with the given filename.
uint Scan(std::string_view extension, Subdirectory sd, bool tars=true, bool recursive=true)
Scan for files with the given extension in the given search path.
bool FileExists(const std::string &filename)
Test whether the given filename exists.
void DeterminePaths(const char *exe, bool only_local_path)
Acquire the base paths (personal dir and game data dir), fill all other paths (save dir,...
@ SCENARIO
Scan for scenarios and heightmaps.
virtual ~FileScanner()=default
Destruct the proper one...
std::string _personal_dir
custom directory for personal settings, saves, newgrf, etc.
Subdirectory
The different kinds of subdirectories OpenTTD uses.
std::optional< FileHandle > FioFOpenFile(const std::string &filename, const char *mode, Subdirectory subdir, size_t *filesize=nullptr)
Opens a OpenTTD file somewhere in a personal or global directory.
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
Helper for scanning for files with tar as extension.
bool ExtractTar(const std::string &tar_filename, Subdirectory subdir)
Extract the tar with the given filename in the directory where the tar resides.
Helper for scanning for files with a given name.
@ BASESET
Scan for base sets.
Mode
The mode of tar scanning.
std::string FioFindFullPath(Subdirectory subdir, const std::string &filename)
Find a path to the filename in one of the search directories.
const char * FiosGetScreenshotDir()
Get the directory for screenshots.