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 | |
| Hot reload. | |
| ~HotReload () override | |
| Hot reload. | |
| 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) |
| Unbinds unbind. | |
| 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. Virtual paths walk the VFS. .., ../…, and absolute OS directories walk the real filesystem so an app under apps/<name> can watch its parent workflow. Event paths are game/VFS relative: files under the working directory keep cwd-relative names (main.nut); siblings of the app report from the watch root (editors/skill.vm.nut). | |
| bool | watchNewDirectory (std::string path) |
| If path is a directory, recursively add watches for it and its current descendants. | |
| bool | startRemoteSync (std::string url, int pollMs=1000) |
| Starts remote sync. | |
| void | stopRemoteSync () |
| Stops remote sync. | |
| void | setRemoteHotDir (std::string dir) |
| Sets the remote hot dir. | |
| bool | isRemoteSyncing () const |
| True when remote syncing. | |
| std::string | remoteSyncStatus () const |
| Remote sync status. | |
| std::string | pollRemoteChange () |
| Polls remote change. | |
Public 成员函数 继承自 eve::Module | |
| virtual | ~Module () |
| Module. | |
| virtual std::string | getName () const =0 |
| Returns the name. | |
静态 Public 成员函数 | |
| static std::string | normalizePath (std::string path) |
| Normalize 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 第 36 行定义.
构造及析构函数说明
◆ HotReload()
|
default |
Hot reload.
◆ ~HotReload()
|
override |
成员函数说明
◆ 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 第 285 行定义.
引用了 kind, normalizePath() , 以及 path.
◆ isRemoteSyncing()
| bool eve::filesystem::HotReload::isRemoteSyncing | ( | ) | const |
True when remote syncing.
Whether the remote sync thread is currently running.
在文件 HotReload.cpp 第 573 行定义.
◆ Module_REG()
| eve::filesystem::HotReload::Module_REG | ( | HotReload | ) |
◆ normalizePath()
|
static |
Normalize path.
在文件 HotReload.cpp 第 276 行定义.
被这些函数引用 bind(), eve::cmd::Cmdline::McpHost(), tryReload(), unbind(), watchNewDirectory() , 以及 watchTree().
◆ pollRemoteChange()
| std::string eve::filesystem::HotReload::pollRemoteChange | ( | ) |
Polls remote change.
Pop the next changed virtual path reported by remote sync. Returns empty string when the queue is drained.
在文件 HotReload.cpp 第 580 行定义.
引用了 p.
◆ remoteSyncStatus()
| std::string eve::filesystem::HotReload::remoteSyncStatus | ( | ) | const |
Remote sync status.
Last sync status: "idle" | "syncing" | "synced" | "error:<reason>".
在文件 HotReload.cpp 第 575 行定义.
◆ setRemoteHotDir()
| void eve::filesystem::HotReload::setRemoteHotDir | ( | std::string | dir | ) |
Sets the remote hot 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 第 381 行定义.
引用了 dir.
◆ startRemoteSync()
| bool eve::filesystem::HotReload::startRemoteSync | ( | std::string | url, |
| int | pollMs = 1000 |
||
| ) |
Starts remote sync.
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 第 537 行定义.
◆ stopRemoteSync()
| void eve::filesystem::HotReload::stopRemoteSync | ( | ) |
Stops remote sync.
Stop the remote sync thread (joining it). Safe to call twice.
在文件 HotReload.cpp 第 560 行定义.
被这些函数引用 ~HotReload().
◆ tryReload()
| bool eve::filesystem::HotReload::tryReload | ( | std::string | path | ) |
Offer a (normalized) path to the registered reloaders; true if any reloaded.
在文件 HotReload.cpp 第 296 行定义.
引用了 kind, normalizePath(), path , 以及 r.
◆ unbind()
| void eve::filesystem::HotReload::unbind | ( | std::string | path | ) |
◆ watchNewDirectory()
| bool eve::filesystem::HotReload::watchNewDirectory | ( | std::string | path | ) |
If path is a directory, recursively add watches for it and its current descendants.
- 返回
- True when path names a directory, including one that was already watched.
在文件 HotReload.cpp 第 335 行定义.
引用了 info, normalizePath(), path , 以及 watchTree().
◆ watchTree()
| int eve::filesystem::HotReload::watchTree | ( | std::string | root = "." | ) |
Recursively watch root and all subdirectories. Virtual paths walk the VFS. .., ../…, and absolute OS directories walk the real filesystem so an app under apps/<name> can watch its parent workflow. Event paths are game/VFS relative: files under the working directory keep cwd-relative names (main.nut); siblings of the app report from the watch root (editors/skill.vm.nut).
- 返回
- Number of directory watches added. @cost One OS watcher per directory in the tree; call at boot, not per frame.
在文件 HotReload.cpp 第 317 行定义.
引用了 info, normalizePath() , 以及 root.
被这些函数引用 watchNewDirectory().
该类的文档由以下文件生成:
- src/modules/filesystem/HotReload.h
- src/modules/filesystem/HotReload.cpp
Public 成员函数 继承自