You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-1Lines changed: 12 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,10 +72,18 @@ func main() {
72
72
}
73
73
}()
74
74
75
+
// if this is a link, it will follow all the links and watch the file pointed to
75
76
err = watcher.Add("/tmp/foo")
76
77
if err != nil {
77
78
log.Fatal(err)
78
79
}
80
+
81
+
// this will watch the link, rather than the file it points to
82
+
err = watcher.AddRaw("/tmp/link")
83
+
if err != nil {
84
+
log.Fatal(err)
85
+
}
86
+
79
87
<-done
80
88
}
81
89
```
@@ -90,6 +98,10 @@ See [example_test.go](https://github.com/fsnotify/fsnotify/blob/master/example_t
90
98
91
99
## FAQ
92
100
101
+
**Are symlinks resolved?**
102
+
Symlinks are implicitly resolved by [`filepath.EvalSymlinks(path)`](https://golang.org/pkg/path/filepath/#EvalSymlinks) when `watcher.Add(name)` is used. If that is not desired, you can use `watcher.AddRaw(name)` to not follow any symlinks before watching. See [example_test.go](https://github.com/fsnotify/fsnotify/blob/master/example_test.go).
103
+
104
+
93
105
**When a file is moved to another directory is it still being watched?**
94
106
95
107
No (it shouldn't be, unless you are watching where it was moved to).
@@ -127,4 +139,3 @@ fsnotify requires support from underlying OS to work. The current NFS protocol d
0 commit comments