diff --git a/src/openrct2/core/FileWatcher.cpp b/src/openrct2/core/FileWatcher.cpp index a9b7d853a7..d48b47ef0b 100644 --- a/src/openrct2/core/FileWatcher.cpp +++ b/src/openrct2/core/FileWatcher.cpp @@ -77,6 +77,7 @@ FileWatcher::WatchDescriptor::~WatchDescriptor() FileWatcher::FileWatcher(const std::string &directoryPath) { #ifdef _WIN32 + _path = directoryPath; _directoryHandle = CreateFileA(directoryPath.c_str(), FILE_LIST_DIRECTORY, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, nullptr); if (_directoryHandle == INVALID_HANDLE_VALUE) { @@ -127,7 +128,8 @@ void FileWatcher::WatchDirectory() std::wstring fileNameW(notifyInfo->FileName, notifyInfo->FileNameLength / sizeof(wchar_t)); auto fileName = String::ToUtf8(fileNameW); - onFileChanged(fileName); + auto path = fs::path(_path) / fs::path(fileName); + onFileChanged(path.u8string()); } while (notifyInfo->NextEntryOffset != 0); } diff --git a/src/openrct2/core/FileWatcher.h b/src/openrct2/core/FileWatcher.h index 0c1dc23750..da3fb0b9c0 100644 --- a/src/openrct2/core/FileWatcher.h +++ b/src/openrct2/core/FileWatcher.h @@ -17,6 +17,7 @@ class FileWatcher private: std::thread _watchThread; #ifdef _WIN32 + std::string _path; HANDLE _directoryHandle{}; #else struct FileDescriptor diff --git a/src/openrct2/scripting/ScriptEngine.cpp b/src/openrct2/scripting/ScriptEngine.cpp index a0f4e7cbdc..50f0dfe720 100644 --- a/src/openrct2/scripting/ScriptEngine.cpp +++ b/src/openrct2/scripting/ScriptEngine.cpp @@ -114,7 +114,7 @@ void ScriptEngine::AutoReloadPlugins() auto findResult = std::find_if(_plugins.begin(), _plugins.end(), [&path](const std::shared_ptr& plugin) { - return path == plugin->GetPath(); + return Path::Equals(path, plugin->GetPath()); }); if (findResult != _plugins.end()) {