Path→reload dispatcher for soft hot reload. Driven from load.nut via pollWatch → tryReload; also used by watchTree. 更多...
#include <HotReload.h>
Public 成员函数 | |
| Module_REG (HotReload) | |
| HotReload ()=default | |
| ~HotReload () override | |
| void | bind (std::string path, std::string kind="auto") |
| Pin a path to one reloader kind ("particle" / "tilemap" / "texture" / whatever a linked module registers), bypassing extension matching. "auto" (the default) lets every reloader claim the path itself. | |
| void | unbind (std::string path) |
| bool | tryReload (std::string path) |
| Offer a (normalized) path to the registered reloaders; true if any reloaded. | |
| int | watchTree (std::string root=".") |
| Recursively watch root and all subdirectories. Returns number of watches added. | |
| bool | startRemoteSync (std::string url, int pollMs=1000) |
| void | stopRemoteSync () |
| void | setRemoteHotDir (std::string dir) |
| bool | isRemoteSyncing () const |
| std::string | remoteSyncStatus () const |
| std::string | pollRemoteChange () |
Public 成员函数 继承自 eve::Module | |
| virtual | ~Module () |
| virtual std::string | getName () const =0 |
静态 Public 成员函数 | |
| static std::string | normalizePath (std::string path) |
详细描述
Path→reload dispatcher for soft hot reload. Driven from load.nut via pollWatch → tryReload; also used by watchTree.
What a given file means is not known here. Modules that own an asset kind register an eve::caps::IAssetReloader (see common/AssetReloader.h) and this only routes paths to them, so reloadable kinds grow with the linked module set rather than with this file.
On top of the local watchers, HotReload can act as a remote hot-reload client: a background thread polls a dev server (eve dev) manifest, downloads changed files into a writable overlay directory mounted at "/" (see Filesystem::mountRealDirectory), and queues the changed virtual paths for the script layer to dofile / reload. This is what makes hot reload work on read-only mobile bundles (iOS app bundle / Android APK).
在文件 HotReload.h 第 34 行定义.
构造及析构函数说明
◆ HotReload()
|
default |
◆ ~HotReload()
|
override |
在文件 HotReload.cpp 第 114 行定义.
引用了 stopRemoteSync().
成员函数说明
◆ bind()
| void eve::filesystem::HotReload::bind | ( | std::string | path, |
| std::string | kind = "auto" |
||
| ) |
Pin a path to one reloader kind ("particle" / "tilemap" / "texture" / whatever a linked module registers), bypassing extension matching. "auto" (the default) lets every reloader claim the path itself.
在文件 HotReload.cpp 第 125 行定义.
引用了 kind , 以及 normalizePath().
◆ isRemoteSyncing()
| bool eve::filesystem::HotReload::isRemoteSyncing | ( | ) | const |
Whether the remote sync thread is currently running.
在文件 HotReload.cpp 第 413 行定义.
◆ Module_REG()
| eve::filesystem::HotReload::Module_REG | ( | HotReload | ) |
◆ normalizePath()
|
static |
◆ pollRemoteChange()
| std::string eve::filesystem::HotReload::pollRemoteChange | ( | ) |
Pop the next changed virtual path reported by remote sync. Returns empty string when the queue is drained.
在文件 HotReload.cpp 第 420 行定义.
引用了 p.
◆ remoteSyncStatus()
| std::string eve::filesystem::HotReload::remoteSyncStatus | ( | ) | const |
Last sync status: "idle" | "syncing" | "synced" | "error:<reason>".
在文件 HotReload.cpp 第 415 行定义.
◆ setRemoteHotDir()
| void eve::filesystem::HotReload::setRemoteHotDir | ( | std::string | dir | ) |
Override the writable overlay directory used to stage remote-sync downloads (default: platform appdata/EVE/hotreload, or the internal storage hotreload dir on Android). Must be called before startRemoteSync.
在文件 HotReload.cpp 第 221 行定义.
引用了 dir.
◆ startRemoteSync()
| bool eve::filesystem::HotReload::startRemoteSync | ( | std::string | url, |
| int | pollMs = 1000 |
||
| ) |
Start remote hot reload against a dev server. Background thread polls <url>/manifest and downloads changed files via <url>/raw/<path> into a writable overlay directory (mounted in front of the bundled game source), then queues the virtual paths. Returns false if already running.
- 参数
-
url Base URL, e.g. "http://192.168.1.5:8765". pollMs Poll interval in milliseconds (default 1000).
在文件 HotReload.cpp 第 377 行定义.
◆ stopRemoteSync()
| void eve::filesystem::HotReload::stopRemoteSync | ( | ) |
Stop the remote sync thread (joining it). Safe to call twice.
在文件 HotReload.cpp 第 400 行定义.
被这些函数引用 ~HotReload().
◆ tryReload()
| bool eve::filesystem::HotReload::tryReload | ( | std::string | path | ) |
Offer a (normalized) path to the registered reloaders; true if any reloaded.
在文件 HotReload.cpp 第 136 行定义.
引用了 eve::caps::IAssetReloader::handlesPath(), kind, normalizePath(), eve::cap::query(), eve::caps::IAssetReloader::reload() , 以及 eve::caps::IAssetReloader::reloadKind().
◆ unbind()
| void eve::filesystem::HotReload::unbind | ( | std::string | path | ) |
在文件 HotReload.cpp 第 132 行定义.
引用了 normalizePath().
◆ watchTree()
| int eve::filesystem::HotReload::watchTree | ( | std::string | root = "." | ) |
Recursively watch root and all subdirectories. Returns number of watches added.
在文件 HotReload.cpp 第 155 行定义.
引用了 dir, name , 以及 normalizePath().
该类的文档由以下文件生成:
- src/modules/filesystem/HotReload.h
- src/modules/filesystem/HotReload.cpp
Public 成员函数 继承自