1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-21 06:43:04 +01:00

Fix FileWatcher for Windows

This commit is contained in:
Ted John
2018-03-31 10:27:45 +01:00
parent 26eb91016e
commit 5ba96a34ac
3 changed files with 5 additions and 2 deletions

View File

@@ -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);
}