MCPcopy Index your code
hub / github.com/coder/coder / translateEvent

Function translateEvent

agent/filefinder/watcher_fs.go:186–213  ·  view source on GitHub ↗
(ev fsnotify.Event)

Source from the content-addressed store, hash-verified

184}
185
186func translateEvent(ev fsnotify.Event) *FSEvent {
187 var op FSEventOp
188 switch {
189 case ev.Op&fsnotify.Create != 0:
190 op = OpCreate
191 case ev.Op&fsnotify.Remove != 0:
192 op = OpRemove
193 case ev.Op&fsnotify.Rename != 0:
194 op = OpRename
195 case ev.Op&fsnotify.Write != 0:
196 op = OpModify
197 default:
198 return nil
199 }
200 isDir := false
201 if op == OpCreate || op == OpModify {
202 fi, err := os.Lstat(ev.Name)
203 if err == nil {
204 isDir = fi.IsDir()
205 }
206 }
207 if isDir {
208 if _, skip := skipDirs[filepath.Base(ev.Name)]; skip {
209 return nil
210 }
211 }
212 return &FSEvent{Op: op, Path: ev.Name, IsDir: isDir}
213}

Callers 1

loopMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected