diff options
| author | Bernhard Guillon <Bernhard.Guillon@begu.org> | 2026-07-07 19:39:23 +0200 |
|---|---|---|
| committer | Bernhard Guillon <Bernhard.Guillon@begu.org> | 2026-07-07 19:39:23 +0200 |
| commit | d664a05e06742513c7dbdeb860bbd89a2a12edb7 (patch) | |
| tree | 5853de62e6bdd02796b2a3d2bb62191ebfe4d1e3 | |
| parent | ed8cac4ac29250ae8c34c82452a5e02425a8e3ba (diff) | |
| download | sourcewatch-d664a05e06742513c7dbdeb860bbd89a2a12edb7.tar.gz sourcewatch-d664a05e06742513c7dbdeb860bbd89a2a12edb7.zip | |
Normalize Windows backslashes to forward slashes in manifest and event paths
| -rw-r--r-- | cmd_windows.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cmd_windows.go b/cmd_windows.go index f722b47..23f75bd 100644 --- a/cmd_windows.go +++ b/cmd_windows.go @@ -319,13 +319,17 @@ func scanDirectory(root string, stack *GitignoreStack) *Manifest { return manifest } +func normalizePath(p string) string { + return filepath.ToSlash(p) +} + func sendManifest(conn net.Conn, manifest *Manifest) error { const batchSize = 1000 files := make([]FileMetaJSON, 0, batchSize) paths := make([]string, 0, batchSize) for path, meta := range manifest.ToJSON() { - paths = append(paths, path) + paths = append(paths, normalizePath(path)) files = append(files, meta) if len(files) >= batchSize { @@ -378,7 +382,7 @@ func sendManifest(conn net.Conn, manifest *Manifest) error { } func sendEvent(conn net.Conn, evt FileEvent) error { - msg := &ProtocolMessage{Path: evt.Path} + msg := &ProtocolMessage{Path: normalizePath(evt.Path)} switch evt.Op { case "create": msg.Type = "event_create" |
