MCPcopy Create free account
hub / github.com/Tencent/UnLua / Watch

Method Watch

Plugins/UnLua/Source/UnLuaEditor/Private/EditorHotReloadWatcher.cpp:27–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25 }
26
27 void FEditorHotReloadWatcher::Watch(const TArray<FString>& Directories)
28 {
29 auto& DirectoryWatcherModule = FModuleManager::LoadModuleChecked<FDirectoryWatcherModule>("DirectoryWatcher");
30 const auto DirectoryWatcher = DirectoryWatcherModule.Get();
31 if (!DirectoryWatcher)
32 return;
33
34 for (const auto& Watcher : Watchers)
35 DirectoryWatcher->UnregisterDirectoryChangedCallback_Handle(Watcher.Directory, Watcher.Handle);
36 Watchers.Reset();
37
38 for (const auto& Directory : Directories)
39 {
40 if (!FPaths::DirectoryExists(Directory))
41 continue;
42 FDirectoryWatcherPayload Watcher;
43 Watcher.Directory = Directory;
44 const auto& Delegate = IDirectoryWatcher::FDirectoryChanged::CreateRaw(this, &FEditorHotReloadWatcher::OnFileChanged);
45 DirectoryWatcher->RegisterDirectoryChangedCallback_Handle(Watcher.Directory, Delegate, Watcher.Handle);
46 }
47 }
48
49 void FEditorHotReloadWatcher::OnModuleLoaded(const FString& ModuleName, const FString& FullPath)
50 {

Callers 1

WatchFunction · 0.80

Calls 2

GetMethod · 0.45
ResetMethod · 0.45

Tested by

no test coverage detected