Index: runtime/bin/file_system_watcher_linux.cc |
diff --git a/runtime/bin/file_system_watcher_linux.cc b/runtime/bin/file_system_watcher_linux.cc |
index bd9806ed9f766fa8ee9b5d050eae4ece628a3470..4a19d344f8c2d0c47d3db33305bf74471c0e006e 100644 |
--- a/runtime/bin/file_system_watcher_linux.cc |
+++ b/runtime/bin/file_system_watcher_linux.cc |
@@ -11,6 +11,7 @@ |
#include <sys/inotify.h> // NOLINT |
#include "bin/fdutils.h" |
+#include "bin/file.h" |
#include "bin/socket.h" |
#include "platform/signal_blocker.h" |
@@ -38,6 +39,7 @@ void FileSystemWatcher::Close(intptr_t id) { |
} |
intptr_t FileSystemWatcher::WatchPath(intptr_t id, |
+ Namespace* namespc, |
const char* path, |
int events, |
bool recursive) { |
@@ -54,7 +56,10 @@ intptr_t FileSystemWatcher::WatchPath(intptr_t id, |
if ((events & kMove) != 0) { |
list_events |= IN_MOVE; |
} |
- int path_id = NO_RETRY_EXPECTED(inotify_add_watch(id, path, list_events)); |
+ const char* resolved_path = File::GetCanonicalPath(namespc, path); |
+ path = resolved_path != NULL ? resolved_path : path; |
+ int path_id = NO_RETRY_EXPECTED(inotify_add_watch( |
+ id, path, list_events)); |
if (path_id < 0) { |
return -1; |
} |