Fix hot reload not working with symlinked entire plugins (#230)

This commit is contained in:
Lion 2023-12-28 11:42:39 +01:00 committed by GitHub
commit d65f3cf75b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,7 @@
#include "TPluginMonitor.h" #include "TPluginMonitor.h"
#include "TLuaEngine.h" #include "TLuaEngine.h"
#include <filesystem>
TPluginMonitor::TPluginMonitor(const fs::path& Path, std::shared_ptr<TLuaEngine> Engine) TPluginMonitor::TPluginMonitor(const fs::path& Path, std::shared_ptr<TLuaEngine> Engine)
: mEngine(Engine) : mEngine(Engine)
@ -9,7 +10,7 @@ TPluginMonitor::TPluginMonitor(const fs::path& Path, std::shared_ptr<TLuaEngine>
if (!fs::exists(mPath)) { if (!fs::exists(mPath)) {
fs::create_directories(mPath); fs::create_directories(mPath);
} }
for (const auto& Entry : fs::recursive_directory_iterator(mPath)) { for (const auto& Entry : fs::recursive_directory_iterator(mPath, fs::directory_options::follow_directory_symlink)) {
// TODO: trigger an event when a subfolder file changes // TODO: trigger an event when a subfolder file changes
if (Entry.is_regular_file()) { if (Entry.is_regular_file()) {
mFileTimes[Entry.path().string()] = fs::last_write_time(Entry.path()); mFileTimes[Entry.path().string()] = fs::last_write_time(Entry.path());