PhysFS 文件系统后端实现(挂载/解挂、读写、热重载)。 更多...
#include <Filesystem.h>
Public 成员函数 | |
| Filesystem () | |
| ~Filesystem () override | |
| void | init (const char *arg0) override |
| void | setFused (bool fused) override |
| bool | isFused () const override |
| bool | setupWriteDirectory () override |
| This sets up the save directory. If the it is already set up, nothing happens. | |
| bool | setIdentity (std::string ident, bool appendToPath=false) override |
| Sets the name of the save folder. | |
| std::string | getIdentity () const override |
| bool | setSource (std::string source) override |
| Sets the path to the game source. This can only be set once. | |
| bool | setSourceFromMemory (const void *data, size_t size) override |
| Loads the game source from a packaged archive (.eve / zip) held entirely in memory and mounts it at "/" (no extraction to disk). The bytes are copied and kept alive for the lifetime of the mounted archive. This can only be set once. | |
| std::string | getSource () const override |
| Gets the path to the game source. Returns a 0-length string if the source has not been set. | |
| bool | mount (std::string archive, std::string mountpoint, bool appendToPath=false) override |
| bool | mount (Data *data, std::string archivename, std::string mountpoint, bool appendToPath=false) override |
| bool | mountRealDirectory (std::string realDir, std::string mountpoint, bool appendToPath=false) override |
| bool | unmountRealDirectory (std::string realDir) override |
| bool | unmount (std::string archive) override |
| bool | unmount (Data *data) override |
| filesystem::File * | newFile (std::string filename) const override |
| Creates a new file. | |
| std::string | getWorkingDirectory () override |
| Gets the current working directory. | |
| std::string | getUserDirectory () override |
| Gets the user home directory. | |
| std::string | getAppdataDirectory () override |
| Gets the APPDATA directory. On Windows, this is the folder in the APPDATA% enviroment variable. On Linux, this is the user home folder. | |
| std::string | getSaveDirectory () override |
| Gets the full path of the save folder. | |
| std::string | getSourceBaseDirectory () const override |
| Gets the full path to the directory containing the game source. For example if the game source is C:\Games\mygame.love, this will return C:\Games. | |
| std::string | getRealDirectory (std::string filename) const override |
| Gets the real directory path containing the file. | |
| bool | getInfo (std::string filepath, Info &info) const override |
| Gets information about the item at the specified filepath. Returns false if nothing exists at the path. | |
| bool | createDirectory (std::string dir) override |
| Creates a directory. Write dir must be set. | |
| bool | remove (std::string file) override |
| Removes a file (or directory). | |
| FileData * | read (std::string filename, int64_t size=File::ALL) const override |
| Reads data from a file. | |
| void | write (std::string filename, const void *data, int64_t size) const override |
| Write data to a file. | |
| void | append (std::string filename, const void *data, int64_t size) const override |
| Append data to a file, creating it if it doesn't exist. | |
| std::vector< std::string > | getDirectoryItems (std::string dir) override |
| This "native" method returns a table of all files in a given directory. | |
| void | setSymlinksEnabled (bool enable) override |
| Enable or disable symbolic link support in love.filesystem. | |
| bool | areSymlinksEnabled () const override |
| Gets whether symbolic link support is enabled. | |
| std::vector< std::string > & | getRequirePath () override |
| std::vector< std::string > & | getCRequirePath () override |
| void | allowMountingForPath (const std::string &path) override |
| Allows a full (OS-dependent) path to be used with Filesystem::mount. | |
| bool | watch (std::string path) override |
| Watch a virtual or absolute OS path (file or directory). File watches monitor the parent directory and filter by basename. Returns false if the path cannot be resolved to a real directory. | |
| bool | unwatch (std::string path) override |
| Stop watching a path previously passed to watch(). | |
| void | unwatchAll () override |
| int | getWatchCount () const override |
| std::string | pollWatch () override |
| Pop next watch event kind: "added"|"removed"|"modified"|"movedFrom"|"movedTo". Empty string if queue empty. Path available via getLastWatchPath(). | |
| std::string | getLastWatchPath () const override |
| std::string | getLastWatchRealPath () const override |
Public 成员函数 继承自 eve::filesystem::Filesystem | |
| Module_REG (Filesystem) | |
| Filesystem () | |
| virtual void | setAndroidSaveExternal (bool useExternal=false) |
| This sets the save location on Android. False for internal, true for external | |
| virtual bool | isAndroidSaveExternal () const |
| Gets whether the Android save is external. Returns a bool. | |
| virtual FileData * | newFileData (const void *data, std::string filename, size_t size) const |
| Creates a new FileData object. Data will be copied. | |
| virtual bool | isRealDirectory (const std::string &path) const |
| Gets whether the given full (OS-dependent) path is a directory. | |
| virtual std::string | getExecutablePath () const |
| Gets the full platform-dependent path to the executable. | |
Public 成员函数 继承自 eve::Module | |
| virtual | ~Module () |
| virtual std::string | getName () const =0 |
详细描述
PhysFS 文件系统后端实现(挂载/解挂、读写、热重载)。
在文件 Filesystem.h 第 19 行定义.
构造及析构函数说明
◆ Filesystem()
| eve::filesystem::physfs::Filesystem::Filesystem | ( | ) |
在文件 Filesystem.cpp 第 76 行定义.
引用了 c, getModInst , 以及 init().
◆ ~Filesystem()
|
overridevirtual |
成员函数说明
◆ allowMountingForPath()
|
overridevirtual |
Allows a full (OS-dependent) path to be used with Filesystem::mount.
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 638 行定义.
◆ append()
|
overridevirtual |
Append data to a file, creating it if it doesn't exist.
- 参数
-
filename The name of the file to write to. data The data to append. size The size in bytes of the data to append.
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 599 行定义.
◆ areSymlinksEnabled()
|
overridevirtual |
Gets whether symbolic link support is enabled.
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 628 行定义.
◆ createDirectory()
|
overridevirtual |
Creates a directory. Write dir must be set.
- 参数
-
dir The directory to create.
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 561 行定义.
引用了 dir , 以及 setupWriteDirectory().
被这些函数引用 setupWriteDirectory().
◆ getAppdataDirectory()
|
overridevirtual |
Gets the APPDATA directory. On Windows, this is the folder in the APPDATA% enviroment variable. On Linux, this is the user home folder.
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 477 行定义.
引用了 getUserDirectory().
被这些函数引用 setIdentity().
◆ getCRequirePath()
|
overridevirtual |
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 636 行定义.
◆ getDirectoryItems()
|
overridevirtual |
This "native" method returns a table of all files in a given directory.
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 608 行定义.
引用了 dir.
◆ getIdentity()
|
overridevirtual |
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 181 行定义.
◆ getInfo()
|
overridevirtual |
Gets information about the item at the specified filepath. Returns false if nothing exists at the path.
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 540 行定义.
引用了 eve::filesystem::Filesystem::Info::modtime, eve::filesystem::Filesystem::Info::size , 以及 eve::filesystem::Filesystem::Info::type.
◆ getLastWatchPath()
|
overridevirtual |
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 794 行定义.
◆ getLastWatchRealPath()
|
overridevirtual |
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 795 行定义.
◆ getRealDirectory()
|
overridevirtual |
Gets the real directory path containing the file.
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 530 行定义.
引用了 dir.
◆ getRequirePath()
|
overridevirtual |
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 634 行定义.
◆ getSaveDirectory()
|
overridevirtual |
Gets the full path of the save folder.
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 506 行定义.
◆ getSource()
|
overridevirtual |
Gets the path to the game source. Returns a 0-length string if the source has not been set.
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 244 行定义.
◆ getSourceBaseDirectory()
|
overridevirtual |
Gets the full path to the directory containing the game source. For example if the game source is C:\Games\mygame.love, this will return C:\Games.
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 508 行定义.
◆ getUserDirectory()
|
overridevirtual |
Gets the user home directory.
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 463 行定义.
引用了 dir.
被这些函数引用 getAppdataDirectory() , 以及 setupWriteDirectory().
◆ getWatchCount()
|
overridevirtual |
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 776 行定义.
◆ getWorkingDirectory()
|
overridevirtual |
Gets the current working directory.
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 442 行定义.
引用了 EVENGINE_MAX_PATH.
◆ init()
|
overridevirtual |
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 104 行定义.
引用了 setSymlinksEnabled().
被这些函数引用 Filesystem().
◆ isFused()
|
overridevirtual |
◆ mount() [1/2]
|
overridevirtual |
◆ mount() [2/2]
|
overridevirtual |
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 317 行定义.
引用了 EVENGINE_PATH_SEPARATOR, getSourceBaseDirectory() , 以及 isFused().
◆ mountRealDirectory()
|
overridevirtual |
Mounts a real (OS-level) directory at a virtual mountpoint, bypassing the safety checks in mount(). Used by hot reload to overlay a writable sync directory in front of a read-only bundled/packaged game source.
- 参数
-
realDir Absolute OS path to an existing directory. mountpoint Virtual path to mount at ("" = "/"). appendToPath False = highest priority (searched first).
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 365 行定义.
◆ newFile()
|
overridevirtual |
◆ pollWatch()
|
overridevirtual |
Pop next watch event kind: "added"|"removed"|"modified"|"movedFrom"|"movedTo". Empty string if queue empty. Path available via getLastWatchPath().
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 781 行定义.
引用了 eve::filesystem::FileWatch::Event::kind, eve::filesystem::FileWatch::Event::path , 以及 eve::filesystem::FileWatch::Event::realPath.
◆ read()
|
overridevirtual |
Reads data from a file.
- 参数
-
filename The name of the file to read from. size The size in bytes of the data to read.
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 581 行定义.
引用了 file.
◆ remove()
|
overridevirtual |
Removes a file (or directory).
- 参数
-
file The file or directory to remove.
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 571 行定义.
引用了 file , 以及 setupWriteDirectory().
◆ setFused()
|
overridevirtual |
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 112 行定义.
◆ setIdentity()
|
overridevirtual |
Sets the name of the save folder.
- 参数
-
ident The name of the game. Will be used to to create the folder in the LOVE data folder.
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 123 行定义.
引用了 EVENGINE_APPDATA_FOLDER, EVENGINE_APPDATA_PREFIX, EVENGINE_PATH_SEPARATOR, getAppdataDirectory() , 以及 eve::filesystem::Filesystem::isAndroidSaveExternal().
◆ setSource()
|
overridevirtual |
Sets the path to the game source. This can only be set once.
- 参数
-
source Path to a directory or a .love-file.
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 183 行定义.
◆ setSourceFromMemory()
|
overridevirtual |
Loads the game source from a packaged archive (.eve / zip) held entirely in memory and mounts it at "/" (no extraction to disk). The bytes are copied and kept alive for the lifetime of the mounted archive. This can only be set once.
- 参数
-
data Pointer to the archive bytes. size Number of bytes.
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 246 行定义.
引用了 data.
◆ setSymlinksEnabled()
|
overridevirtual |
Enable or disable symbolic link support in love.filesystem.
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 622 行定义.
被这些函数引用 init().
◆ setupWriteDirectory()
|
overridevirtual |
This sets up the save directory. If the it is already set up, nothing happens.
- 返回
- True on success, false otherwise.
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 270 行定义.
引用了 createDirectory() , 以及 getUserDirectory().
被这些函数引用 createDirectory() , 以及 remove().
◆ unmount() [1/2]
|
overridevirtual |
◆ unmount() [2/2]
|
overridevirtual |
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 389 行定义.
引用了 EVENGINE_PATH_SEPARATOR, getSourceBaseDirectory() , 以及 isFused().
被这些函数引用 unmount().
◆ unmountRealDirectory()
|
overridevirtual |
Unmounts a directory previously added via mountRealDirectory().
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 380 行定义.
引用了 ok.
◆ unwatch()
|
overridevirtual |
Stop watching a path previously passed to watch().
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 770 行定义.
◆ unwatchAll()
|
overridevirtual |
◆ watch()
|
overridevirtual |
Watch a virtual or absolute OS path (file or directory). File watches monitor the parent directory and filter by basename. Returns false if the path cannot be resolved to a real directory.
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 764 行定义.
引用了 eve::filesystem::FileWatch::add() , 以及 filter.
◆ write()
|
overridevirtual |
Write data to a file.
- 参数
-
filename The name of the file to write to. data The data to write. size The size in bytes of the data to write.
实现了 eve::filesystem::Filesystem.
在文件 Filesystem.cpp 第 590 行定义.
该类的文档由以下文件生成:
- src/modules/filesystem/physfs/Filesystem.h
- src/modules/filesystem/physfs/Filesystem.cpp
Public 成员函数 继承自