Skip to content
Myr

Update charlievieth/fastwalk to use forward-slashes on WSL and MSYS (#3907)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

This commit changes FZF to enforce that all paths are joined with forward-slashes when running on WSL or MSYS even when the FZF binary was compiled for Windows. Update: github.com/charlievieth/fastwalk Fixes: https://github.com/junegunn/fzf/issues/3859 ---------

authored by Charlie Vieth · committed by GitHub · parent 039a2f1 · Browse files · 3 files+23 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>

Diff stats

3 files+23 added−5 removed

  • other:+23 added−5 removed

3 files+23 added−5 removed

modified:src/reader.go+20 added-2 removed
231 unmodified lines
232 }233 return false234}235236func trimPath(path string) string {237 bytes := stringBytes(path)238239 for len(bytes) > 1 && bytes[0] == '.' && (bytes[1] == '/' || bytes[1] == '\\') {240 bytes = bytes[2:]241 }242243 if len(bytes) == 0 {244 return "."245 }246247 return byteString(bytes)248}249250func (r *Reader) readFiles(root string, opts walkerOpts, ignores []string) bool {251 r.killed = false238 conf := fastwalk.Config{Follow: opts.follow}252 conf := fastwalk.Config{253 Follow: opts.follow,254 // Use forward slashes when running a Windows binary under WSL or MSYS255 ToSlash: fastwalk.DefaultToSlash(),256 }257 fn := func(path string, de os.DirEntry, err error) error {258 if err != nil {259 return nil260 }243 path = filepath.Clean(path)261 path = trimPath(path)262 if path != "." {263 isDir := de.IsDir()264 if isDir || opts.follow && isSymlinkToDir(path, de) {265 base := filepath.Base(path)
51 unmodified lines
modified:go.mod+1 added-1 removed
1module github.com/junegunn/fzf23require (4 github.com/charlievieth/fastwalk v1.0.44 github.com/charlievieth/fastwalk v1.0.7-0.20240703190418-87029d9318155 github.com/gdamore/tcell/v2 v2.7.46 github.com/mattn/go-isatty v0.0.207 github.com/mattn/go-shellwords v1.0.128 github.com/rivo/uniseg v0.4.7
12 unmodified lines
modified:go.sum+2 added-2 removed
1github.com/charlievieth/fastwalk v1.0.4 h1:EG3y5L1XBa8VftvpONuQlfe5sNuf1xzGpm59bdgCDwo=2github.com/charlievieth/fastwalk v1.0.4/go.mod h1:JSfglY/gmL/rqsUS1NCsJTocB5n6sSl9ApAqif4CUbs=1github.com/charlievieth/fastwalk v1.0.7-0.20240703190418-87029d931815 h1:4PRbYm9OMgH0bcdZZqMXA/AoOvpGy4l0H6g9Au/kgGA=2github.com/charlievieth/fastwalk v1.0.7-0.20240703190418-87029d931815/go.mod h1:rV19+IF9Y2TYQNy4MqEk5M/spNHjKsA0i71yrsv2p4E=3github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko=4github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg=5github.com/gdamore/tcell/v2 v2.7.4 h1:sg6/UnTM9jGpZU+oFYAsDahfchWAFW8Xx2yFinNSAYU=6github.com/gdamore/tcell/v2 v2.7.4/go.mod h1:dSXtXTSK0VsW1biw65DZLZ2NKr7j0qP/0J7ONmsraWg=
51 unmodified lines