载入中...
搜索中...
未找到
HotReload.cpp
浏览该文件的文档.
2
4#include "common/Capability.h"
5#include "common/Module.h"
8
9#ifndef EVENGINE_WEBGPU
10#include <Poco/Exception.h>
11#include <Poco/JSON/Array.h>
12#include <Poco/JSON/Object.h>
13#include <Poco/JSON/Parser.h>
14#include <Poco/JSON/Stringifier.h>
15#include <Poco/Net/HTTPClientSession.h>
16#include <Poco/Net/HTTPRequest.h>
17#include <Poco/Net/HTTPResponse.h>
18#include <Poco/StreamCopier.h>
19#include <Poco/Timespan.h>
20#include <Poco/URI.h>
21#endif
22
23#include <simplesquirrel/simplesquirrel.hpp>
24
25#if defined(EVENGINE_ANDROID)
26#include "android/android.h"
27#include <SDL2/SDL.h>
28#elif defined(EVENGINE_IOS)
29#include "ios/ios.h"
30#endif
31
32#include <cctype>
33#include <chrono>
34#include <cstdio>
35#include <filesystem>
36#include <fstream>
37#include <sstream>
38#include <string>
39#include <system_error>
40#include <utility>
41#include <vector>
42
43namespace eve::filesystem {
44namespace {
45
46std::string joinDir(const std::string &dir, const std::string &name) {
47 if (dir.empty() || dir == ".") return name;
48 if (dir.back() == '/' || dir.back() == '\\') return dir + name;
49 return dir + "/" + name;
50}
51
52std::filesystem::path pathFromUtf8(const std::string &text) {
53 const auto *data = reinterpret_cast<const char8_t *>(text.data());
54 return std::filesystem::path(std::u8string_view(data, text.size()));
55}
56
57std::string pathToUtf8(const std::filesystem::path &p) {
58 auto u8 = p.u8string();
59 return std::string(reinterpret_cast<const char *>(u8.data()), u8.size());
60}
61
62bool looksAbsoluteOs(const std::string &path) {
63 if (path.empty()) return false;
64 if (path[0] == '/' || path[0] == '\\') return true;
65#ifdef _WIN32
66 if (path.size() >= 2 && path[1] == ':') return true;
67#endif
68 return false;
69}
70
71bool hasParentSegment(const std::string &path) {
72 if (path == "..") return true;
73 if (path.size() >= 3 && (path.compare(0, 3, "../") == 0 || path.compare(0, 3, "..\\") == 0))
74 return true;
75 return path.find("/..") != std::string::npos || path.find("\\..") != std::string::npos;
76}
77
78bool skipWatchDirName(const std::string &name) {
79 return name == ".git" || name == "build" || name == "third-party" || name == "node_modules" ||
80 name == ".cursor" || name == ".local-debug" || name == "CMakeFiles";
81}
82
83std::string posixRelative(const std::filesystem::path &dir, const std::filesystem::path &root) {
84 std::error_code ec;
85 auto rel = std::filesystem::relative(dir, root, ec);
86 if (ec) return {};
87 std::string s = rel.generic_string();
88 if (s.empty()) return ".";
89 return s;
90}
91
92bool isPathPrefix(const std::filesystem::path &prefix, const std::filesystem::path &full) {
93 std::error_code ec;
94 auto a = std::filesystem::weakly_canonical(prefix, ec);
95 if (ec) a = prefix.lexically_normal();
96 auto b = std::filesystem::weakly_canonical(full, ec);
97 if (ec) b = full.lexically_normal();
98 std::string as = a.generic_string();
99 std::string bs = b.generic_string();
100 if (as.size() > bs.size()) return false;
101#ifdef _WIN32
102 for (char &ch : as) ch = static_cast<char>(std::tolower(static_cast<unsigned char>(ch)));
103 for (char &ch : bs) ch = static_cast<char>(std::tolower(static_cast<unsigned char>(ch)));
104#endif
105 if (bs.compare(0, as.size(), as) != 0) return false;
106 return bs.size() == as.size() || bs[as.size()] == '/';
107}
108
109int watchTreeVfs(Filesystem *fs, const std::string &root) {
110 int added = 0;
111 std::vector<std::string> stack;
112 stack.push_back(root == "." ? std::string(".") : root);
113
114 while (!stack.empty()) {
115 std::string dir = stack.back();
116 stack.pop_back();
117 if (fs->watch(dir)) ++added;
118
119 std::vector<std::string> items;
120 try {
121 if (dir == "." || dir.empty())
122 items = fs->getDirectoryItems("");
123 else
124 items = fs->getDirectoryItems(dir);
125 } catch (...) {
126 continue;
127 }
128
129 for (const auto &item : items) {
130 if (item.empty() || item == "." || item == "..") continue;
131 const std::string child = (dir == "." || dir.empty()) ? item : joinDir(dir, item);
132 Filesystem::Info info{};
133 if (!fs->getInfo(child, info)) continue;
134 if (info.type == "directory") stack.push_back(child);
135 }
136 }
137 return added;
138}
139
140int watchTreeOs(Filesystem *fs, const std::filesystem::path &realRoot) {
141 std::error_code ec;
142 if (!std::filesystem::is_directory(realRoot, ec)) return 0;
143
144 const auto cwd = pathFromUtf8(fs->getWorkingDirectory());
145 auto reportFor = [&](const std::filesystem::path &dir) -> std::string {
146 std::error_code canonEc;
147 auto d = std::filesystem::weakly_canonical(dir, canonEc);
148 if (canonEc) d = dir;
149 auto c = std::filesystem::weakly_canonical(cwd, canonEc);
150 if (canonEc) c = cwd;
151 if (isPathPrefix(c, d)) {
152 const std::string rel = posixRelative(d, c);
153 return rel.empty() ? "." : rel;
154 }
155 const std::string rel = posixRelative(d, realRoot);
156 return rel.empty() ? "." : rel;
157 };
158
159 int added = 0;
160 if (fs->watchRealDirectory(pathToUtf8(realRoot), reportFor(realRoot)).ok()) ++added;
161
162 auto it = std::filesystem::recursive_directory_iterator(
163 realRoot, std::filesystem::directory_options::skip_permission_denied, ec);
164 const auto end = std::filesystem::recursive_directory_iterator();
165 for (; it != end; it.increment(ec)) {
166 if (ec) {
167 ec.clear();
168 continue;
169 }
170 std::error_code dirEc;
171 if (!it->is_directory(dirEc)) continue;
172 const auto name = it->path().filename().string();
173 if (name.empty() || name == "." || name == ".." || skipWatchDirName(name)) {
174 it.disable_recursion_pending();
175 continue;
176 }
177 const auto &dir = it->path();
178 // When watching a parent workflow, skip sibling apps (apps/battle while
179 // running apps/skill) but keep the current working directory.
180 if (isPathPrefix(realRoot, cwd)) {
181 const auto appsDir = cwd.parent_path();
182 if (isPathPrefix(appsDir, dir) && !isPathPrefix(dir, appsDir) && !isPathPrefix(cwd, dir)) {
183 it.disable_recursion_pending();
184 continue;
185 }
186 }
187 const std::string report = reportFor(dir);
188 if (report.empty() || report.find("..") != std::string::npos) continue;
189 if (fs->watchRealDirectory(pathToUtf8(dir), report).ok()) ++added;
190 }
191 return added;
192}
193
194bool resolveOsWatchRoot(Filesystem *fs, const std::string &root, std::filesystem::path &out) {
195 std::error_code ec;
196 std::filesystem::path candidate;
197 if (root == "." || root == "./") {
198 candidate = pathFromUtf8(fs->getWorkingDirectory());
199 } else if (looksAbsoluteOs(root)) {
200 candidate = pathFromUtf8(root);
201 } else {
202 candidate = pathFromUtf8(fs->getWorkingDirectory()) / pathFromUtf8(root);
203 }
204 auto canonical = std::filesystem::weakly_canonical(candidate, ec);
205 if (ec) return false;
206 if (!std::filesystem::is_directory(canonical, ec)) return false;
207 out = std::move(canonical);
208 return true;
209}
210
211// --- Remote sync helpers ---
212
213#ifndef EVENGINE_WEBGPU
214std::string stripTrailingSlash(std::string s) {
215 while (s.size() > 1 && s.back() == '/') s.pop_back();
216 return s;
217}
218
219// Path-escape for use inside a URL path segment (spaces, '#', '?', etc.).
220std::string urlPathEscape(const std::string &s) {
221 std::string out;
222 out.reserve(s.size() + 8);
223 const char hex[] = "0123456789ABCDEF";
224 for (unsigned char c : s) {
225 if (std::isalnum(c) || c == '-' || c == '_' || c == '.' || c == '~' || c == '/') {
226 out += static_cast<char>(c);
227 } else {
228 out += '%';
229 out += hex[c >> 4];
230 out += hex[c & 0xF];
231 }
232 }
233 return out;
234}
235
236// HTTP GET; returns 200 response body or empty on failure.
237std::string httpGet(const std::string &url, int timeoutMs) {
238 try {
239 Poco::URI uri(url);
240 Poco::Net::HTTPClientSession session(uri.getHost(), uri.getPort());
241 session.setTimeout(Poco::Timespan(timeoutMs / 1000, (timeoutMs % 1000) * 1000));
242 std::string path = uri.getPathAndQuery();
243 if (path.empty()) path = "/";
244 Poco::Net::HTTPRequest req(Poco::Net::HTTPRequest::HTTP_GET, path,
245 Poco::Net::HTTPMessage::HTTP_1_1);
246 req.setHost(uri.getHost());
247 std::ostream &os = session.sendRequest(req);
248 (void)os;
249 Poco::Net::HTTPResponse resp;
250 std::istream &is = session.receiveResponse(resp);
251 if (resp.getStatus() != Poco::Net::HTTPResponse::HTTP_OK) return {};
252 std::ostringstream oss;
253 Poco::StreamCopier::copyStream(is, oss);
254 return oss.str();
255 } catch (...) {
256 return {};
257 }
258}
259
260bool writeFileBytes(const std::string &realPath, const std::string &data) {
261 std::error_code ec;
262 std::filesystem::path p(realPath);
263 std::filesystem::create_directories(p.parent_path(), ec);
264 std::ofstream ofs(realPath, std::ios::binary | std::ios::trunc);
265 if (!ofs) return false;
266 ofs.write(data.data(), static_cast<std::streamsize>(data.size()));
267 return ofs.good();
268}
269#endif // !EVENGINE_WEBGPU
270
271} // namespace
272
274
276
277std::string HotReload::normalizePath(std::string path) {
278 for (char &c : path) {
279 if (c == '\\') c = '/';
280 }
281 while (path.size() >= 2 && path[0] == '.' && path[1] == '/') path.erase(0, 2);
282 while (path.size() > 1 && path.back() == '/') path.pop_back();
283 return path;
284}
285
286void HotReload::bind(std::string path, std::string kind) {
287 path = normalizePath(std::move(path));
288 if (path.empty()) return;
289 if (kind.empty()) kind = "auto";
290 bindings_[path] = kind;
291}
292
293void HotReload::unbind(std::string path) {
294 bindings_.erase(normalizePath(std::move(path)));
295}
296
297bool HotReload::tryReload(std::string path) {
298 const std::string norm = normalizePath(std::move(path));
299 if (norm.empty()) return false;
300
301 std::string kind = "auto";
302 auto bit = bindings_.find(norm);
303 if (bit != bindings_.end()) kind = bit->second;
304
305 bool any = false;
306 eve::cap::forEach<eve::caps::IAssetReloader>([&](eve::caps::IAssetReloader *r) {
307 // "auto" lets each reloader claim the path by extension. An explicit
308 // kind targets exactly one reloader and ignores the extension, so a
309 // config file with an unexpected suffix can still be bound by hand.
310 const bool wanted = (kind == "auto") ? r->handlesPath(norm) : (kind == r->reloadKind());
311 if (!wanted) return;
312 auto result = r->reload(norm);
313 if (result.ok() && result.value()) any = true;
314 });
315 return any;
316}
317
318int HotReload::watchTree(std::string root) {
319 StartupStage stage("hotreload: watchTree (recursive walk + register watches)");
320 auto *fs = Filesystem::create();
321 if (!fs) return 0;
322 root = normalizePath(std::move(root));
323 if (root.empty()) root = ".";
324
326 const bool vfsDir = (root == "." || root == "./") ||
327 (!looksAbsoluteOs(root) && !hasParentSegment(root) && fs->getInfo(root, info) &&
328 info.type == "directory");
329 if (vfsDir) return watchTreeVfs(fs, root);
330
331 std::filesystem::path realRoot;
332 if (!resolveOsWatchRoot(fs, root, realRoot)) return 0;
333 return watchTreeOs(fs, realRoot);
334}
335
337 auto *fs = Filesystem::create();
338 if (!fs) return false;
339 path = normalizePath(std::move(path));
340 if (path.empty()) return false;
341
343 if (fs->getInfo(path, info) && info.type == "directory") {
345 return true;
346 }
347 std::filesystem::path real;
348 if (!resolveOsWatchRoot(fs, path, real)) return false;
349 watchTreeOs(fs, real);
350 return true;
351}
352
353// --- Remote hot reload (dev-server sync) ---
354// Poco (HTTP) is not available in the Emscripten/WebGPU build; the API is
355// stubbed there so scripts still compile, and startRemoteSync just fails.
356
357#ifndef EVENGINE_WEBGPU
358
359std::string HotReload::ensureHotDir() {
360 if (!hotDir_.empty()) return hotDir_;
361
362 std::string base;
363#if defined(EVENGINE_ANDROID)
364 base = eve::android::getHotReloadDirectory();
365#elif defined(EVENGINE_IOS)
366 base = eve::ios::getHotReloadDirectory();
367#else
368 {
369 auto *fs = Filesystem::create();
370 base = fs ? fs->getAppdataDirectory() : std::string(".");
371 if (!base.empty() && base.back() == '/') base.pop_back();
372 base += "/EVE/hotreload";
373 }
374#endif
375 if (base.empty()) base = ".";
376 std::error_code ec;
377 std::filesystem::create_directories(base, ec);
378 hotDir_ = base;
379 return hotDir_;
380}
381
383 if (syncStarted_) return;
384 std::error_code ec;
385 std::filesystem::create_directories(dir, ec);
386 hotDir_ = std::move(dir);
387}
388
389bool HotReload::mountHotDir() {
390 if (hotDirMounted_) return true;
391 auto *fs = Filesystem::create();
392 if (!fs) return false;
393 const std::string dir = ensureHotDir();
394 if (!fs->mountRealDirectory(dir, "/", /*appendToPath=*/false)) return false;
395 hotDirMounted_ = true;
396 return true;
397}
398
399bool HotReload::fetchManifest(std::vector<RemoteFile> &out) {
400 const std::string url = stripTrailingSlash(syncUrl_) + "/manifest";
401 const std::string body = httpGet(url, 2000);
402 if (body.empty()) return false;
403
404 try {
405 Poco::JSON::Parser parser;
406 Poco::Dynamic::Var result = parser.parse(body);
407 Poco::JSON::Array::Ptr arr = result.extract<Poco::JSON::Array::Ptr>();
408 if (!arr) return false;
409 for (size_t i = 0; i < arr->size(); ++i) {
410 Poco::JSON::Object::Ptr o = arr->getObject(static_cast<unsigned int>(i));
411 if (!o) continue;
412 RemoteFile f;
413 f.path = o->optValue<std::string>("path", "");
414 if (f.path.empty()) continue;
415 f.size = o->optValue<int64_t>("size", -1);
416 f.mtime = o->optValue<int64_t>("mtime", -1);
417 f.path = normalizePath(std::move(f.path));
418 if (!f.path.empty()) out.push_back(std::move(f));
419 }
420 return true;
421 } catch (...) {
422 return false;
423 }
424}
425
426bool HotReload::downloadFile(const std::string &relPath) {
427 const std::string url = stripTrailingSlash(syncUrl_) + "/raw/" + urlPathEscape(relPath);
428 const std::string body = httpGet(url, 5000);
429 if (body.empty()) return false;
430 const std::string real = joinDir(ensureHotDir(), relPath);
431 return writeFileBytes(real, body);
432}
433
434std::map<std::string, std::pair<int64_t, int64_t>> HotReload::loadRecord() const {
435 std::map<std::string, std::pair<int64_t, int64_t>> record;
436 const std::string real = joinDir(hotDir_, ".eve-manifest.json");
437 std::ifstream ifs(real, std::ios::binary);
438 if (!ifs) return record;
439 std::ostringstream oss;
440 oss << ifs.rdbuf();
441 try {
442 Poco::JSON::Parser parser;
443 Poco::Dynamic::Var result = parser.parse(oss.str());
444 Poco::JSON::Array::Ptr arr = result.extract<Poco::JSON::Array::Ptr>();
445 if (!arr) return record;
446 for (size_t i = 0; i < arr->size(); ++i) {
447 Poco::JSON::Object::Ptr o = arr->getObject(static_cast<unsigned int>(i));
448 if (!o) continue;
449 const std::string path = o->optValue<std::string>("path", "");
450 if (path.empty()) continue;
451 record[path] = {o->optValue<int64_t>("size", -1), o->optValue<int64_t>("mtime", -1)};
452 }
453 } catch (...) {
454 }
455 return record;
456}
457
458void HotReload::saveRecord(const std::map<std::string, std::pair<int64_t, int64_t>> &record) const {
459 Poco::JSON::Array::Ptr arr = new Poco::JSON::Array();
460 for (const auto &kv : record) {
461 Poco::JSON::Object::Ptr o = new Poco::JSON::Object();
462 o->set("path", kv.first);
463 o->set("size", kv.second.first);
464 o->set("mtime", kv.second.second);
465 arr->add(o);
466 }
467 std::ostringstream oss;
468 Poco::JSON::Stringifier::stringify(arr, oss, 0, 0);
469 const std::string real = joinDir(hotDir_, ".eve-manifest.json");
470 writeFileBytes(real, oss.str());
471}
472
473void HotReload::queueChange(std::string path) {
474 std::lock_guard<std::mutex> lock(syncMu_);
475 changedQueue_.push_back(std::move(path));
476}
477
478void HotReload::applyManifest(const std::vector<RemoteFile> &manifest) {
479 auto record = loadRecord();
480 std::map<std::string, bool> seen;
481 for (const auto &file : manifest) {
482 seen[file.path] = true;
483 auto it = record.find(file.path);
484 if (it != record.end() && it->second.first == file.size && it->second.second == file.mtime)
485 continue; // unchanged
486 if (downloadFile(file.path)) {
487 record[file.path] = {file.size, file.mtime};
488 queueChange(file.path);
489 }
490 }
491 // Remove files that disappeared from the server.
492 for (auto it = record.begin(); it != record.end();) {
493 if (seen.find(it->first) != seen.end()) {
494 ++it;
495 continue;
496 }
497 const std::string real = joinDir(hotDir_, it->first);
498 std::error_code ec;
499 std::filesystem::remove(real, ec);
500 queueChange(it->first);
501 it = record.erase(it);
502 }
503 saveRecord(record);
504}
505
506void HotReload::syncLoop(int pollMs) {
507 int failStreak = 0;
508 while (syncRunning_.load()) {
509 std::vector<RemoteFile> manifest;
510 if (fetchManifest(manifest)) {
511 failStreak = 0;
512 {
513 std::lock_guard<std::mutex> l(syncMu_);
514 syncStatus_ = "syncing";
515 }
516 applyManifest(manifest);
517 {
518 std::lock_guard<std::mutex> l(syncMu_);
519 syncStatus_ = "synced";
520 }
521 } else {
522 ++failStreak;
523 {
524 std::lock_guard<std::mutex> l(syncMu_);
525 syncStatus_ = failStreak > 3 ? "error:unreachable" : "idle";
526 }
527 }
528
529 std::unique_lock<std::mutex> l(syncMu_);
530 syncCv_.wait_for(l, std::chrono::milliseconds(pollMs), [this]() { return !syncRunning_.load(); });
531 }
532 {
533 std::lock_guard<std::mutex> l(syncMu_);
534 syncStatus_ = "idle";
535 }
536}
537
538bool HotReload::startRemoteSync(std::string url, int pollMs) {
539 std::lock_guard<std::mutex> lock(syncMu_);
540 if (syncStarted_) return false;
541 url = stripTrailingSlash(std::move(url));
542 if (url.empty()) return false;
543 if (url.rfind("http://", 0) != 0 && url.rfind("https://", 0) != 0) url = "http://" + url;
544
545 syncUrl_ = std::move(url);
546 syncStatus_ = "syncing";
547 syncStarted_ = true;
548 hotDirMounted_ = false;
549 // Mount the overlay dir from the calling (main) thread; PhysFS mount is not
550 // guaranteed thread-safe, so never touch it from the sync thread.
551 if (!mountHotDir()) {
552 syncStarted_ = false;
553 syncStatus_ = "error:mount";
554 return false;
555 }
556 syncRunning_.store(true);
557 syncThread_ = std::thread([this, pollMs]() { syncLoop(pollMs); });
558 return true;
559}
560
562 {
563 std::lock_guard<std::mutex> lock(syncMu_);
564 if (!syncStarted_) return;
565 syncRunning_.store(false);
566 }
567 syncCv_.notify_all();
568 if (syncThread_.joinable()) syncThread_.join();
569 std::lock_guard<std::mutex> lock(syncMu_);
570 syncStarted_ = false;
571 changedQueue_.clear();
572}
573
574bool HotReload::isRemoteSyncing() const { return syncRunning_.load(); }
575
576std::string HotReload::remoteSyncStatus() const {
577 std::lock_guard<std::mutex> lock(syncMu_);
578 return syncStatus_;
579}
580
582 std::lock_guard<std::mutex> lock(syncMu_);
583 if (changedQueue_.empty()) return {};
584 std::string p = std::move(changedQueue_.front());
585 changedQueue_.pop_front();
586 return p;
587}
588
589#endif // !EVENGINE_WEBGPU
590
591#ifdef EVENGINE_WEBGPU
592// WebGPU (browser) build: no Poco HTTP client / threads for remote sync.
593std::string HotReload::ensureHotDir() { return {}; }
594bool HotReload::mountHotDir() { return false; }
595bool HotReload::fetchManifest(std::vector<RemoteFile> &) { return false; }
596bool HotReload::downloadFile(const std::string &) { return false; }
597void HotReload::applyManifest(const std::vector<RemoteFile> &) {}
598std::map<std::string, std::pair<int64_t, int64_t>> HotReload::loadRecord() const { return {}; }
599void HotReload::saveRecord(const std::map<std::string, std::pair<int64_t, int64_t>> &) const {}
600void HotReload::syncLoop(int) {}
601void HotReload::queueChange(std::string) {}
602bool HotReload::startRemoteSync(std::string, int) { return false; }
604void HotReload::setRemoteHotDir(std::string) {}
605bool HotReload::isRemoteSyncing() const { return false; }
606std::string HotReload::remoteSyncStatus() const { return "idle"; }
607std::string HotReload::pollRemoteChange() { return {}; }
608#endif // EVENGINE_WEBGPU
609
610void HotReload::expose(ssq::Table &table) {
611 auto cls = table.addClass(name, HotReload::create, false);
612 expose(cls);
613}
614
615void HotReload::expose(ssq::Class &cls) {
616 cls.addFunc("getName", &HotReload::getName);
617 cls.addFunc("bind", &HotReload::bind);
618 cls.addFunc("unbind", &HotReload::unbind);
619 cls.addFunc("tryReload", &HotReload::tryReload);
620 cls.addFunc("watchTree", &HotReload::watchTree);
621 cls.addFunc("watchNewDirectory", &HotReload::watchNewDirectory);
622 cls.addFunc("startRemoteSync", &HotReload::startRemoteSync);
623 cls.addFunc("stopRemoteSync", &HotReload::stopRemoteSync);
624 cls.addFunc("isRemoteSyncing", &HotReload::isRemoteSyncing);
625 cls.addFunc("remoteSyncStatus", &HotReload::remoteSyncStatus);
626 cls.addFunc("pollRemoteChange", &HotReload::pollRemoteChange);
627}
628
629} // namespace eve::filesystem
int root
Definition AnimSmr.cpp:119
const std::string & s
glm::vec4 p[6]
HSQOBJECT cls
Definition ECS.cpp:39
ScriptComponentRecord record
Definition ECS.cpp:228
std::string name
Definition ECS.cpp:154
double r
std::int32_t c
Poco::JSON::Object::Ptr result
MeleePoint3 b
Definition MeleeHit.cpp:41
MeleePoint3 a
Definition MeleeHit.cpp:40
#define Module_IMPL(ModuleName, newExpr)
Definition Module.h:27
float f
std::string path
Definition PlayHost.cpp:111
std::string uri
std::string file
std::string body
float d
std::string text
ScriptStructure out
size_t end
std::string kind
std::optional< InteractionSession > session
Definition Tactics.cpp:39
V3 dir
Definition TreeMesh.cpp:151
virtual std::string getName() const =0
Returns the name.
StartupStage public API.
EVENGINE_API_FOUNDATION public API.
Path→reload dispatcher for soft hot reload. Driven from load.nut via pollWatch → tryReload; also used...
Definition HotReload.h:37
void setRemoteHotDir(std::string dir)
Sets the remote hot dir.
int watchTree(std::string root=".")
Recursively watch root and all subdirectories. Virtual paths walk the VFS. .., ../…,...
std::string pollRemoteChange()
Polls remote change.
bool isRemoteSyncing() const
True when remote syncing.
bool tryReload(std::string path)
Offer a (normalized) path to the registered reloaders; true if any reloaded.
~HotReload() override
Hot reload.
bool watchNewDirectory(std::string path)
If path is a directory, recursively add watches for it and its current descendants.
void unbind(std::string path)
Unbinds unbind.
void stopRemoteSync()
Stops remote sync.
bool startRemoteSync(std::string url, int pollMs=1000)
Starts remote sync.
std::string remoteSyncStatus() const
Remote sync status.
void bind(std::string path, std::string kind="auto")
Pin a path to one reloader kind ("particle" / "tilemap" / "texture" / whatever a linked module regist...
static std::string normalizePath(std::string path)
Normalize path.
ShapeState * child(const JPH::Body &body, const JPH::SubShapeID &id)
Resolves a native child record for a synchronous callback or query. @ownership Borrowed from the worl...
std::unordered_map< std::string, SkillDefinition > & table()
Definition Skill.cpp:73
glm::uvec4 info