Skip to content

Commit

Permalink
fzf: update charlievieth/fastwahk and use forward-slashes on WSL
Browse files Browse the repository at this point in the history
This commit changes FZF to enforce that all paths are joined with
forward-slashes when running on WSL (Windows Subsystem for Linux)
even when the FZF binary was compiled for Windows.

Update: github.com/charlievieth/fastwalk to v1.0.5
Fixes:  #3859
  • Loading branch information
charlievieth committed Jul 3, 2024
1 parent e1fcdbc commit 628105d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module github.com/junegunn/fzf

require (
github.com/charlievieth/fastwalk v1.0.4
github.com/charlievieth/fastwalk v1.0.6
github.com/gdamore/tcell/v2 v2.7.4
github.com/mattn/go-isatty v0.0.20
github.com/mattn/go-shellwords v1.0.12
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/charlievieth/fastwalk v1.0.4 h1:EG3y5L1XBa8VftvpONuQlfe5sNuf1xzGpm59bdgCDwo=
github.com/charlievieth/fastwalk v1.0.4/go.mod h1:JSfglY/gmL/rqsUS1NCsJTocB5n6sSl9ApAqif4CUbs=
github.com/charlievieth/fastwalk v1.0.6 h1:C7nXgxQIjEkpKWT1fbXGFzQiblwqq2ZsxrR0ohh5IRs=
github.com/charlievieth/fastwalk v1.0.6/go.mod h1:rV19+IF9Y2TYQNy4MqEk5M/spNHjKsA0i71yrsv2p4E=
github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko=
github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg=
github.com/gdamore/tcell/v2 v2.7.4 h1:sg6/UnTM9jGpZU+oFYAsDahfchWAFW8Xx2yFinNSAYU=
Expand Down
17 changes: 6 additions & 11 deletions src/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,11 @@ func isSymlinkToDir(path string, de os.DirEntry) bool {

func (r *Reader) readFiles(root string, opts walkerOpts, ignores []string, sep byte) bool {
r.killed = false
conf := fastwalk.Config{Follow: opts.follow}
replaceSep := sep != os.PathSeparator
conf := fastwalk.Config{
Follow: opts.follow,
// Use forward slashes when running a Windows binary under WSL.
ToSlash: fastwalk.DefaultToSlash(),
}
fn := func(path string, de os.DirEntry, err error) error {
if err != nil {
return nil
Expand All @@ -255,15 +258,7 @@ func (r *Reader) readFiles(root string, opts walkerOpts, ignores []string, sep b
}
}
}
bytes := stringBytes(path)
if replaceSep {
for i, b := range bytes {
if b == os.PathSeparator {
bytes[i] = sep
}
}
}
if ((opts.file && !isDir) || (opts.dir && isDir)) && r.pusher(bytes) {
if ((opts.file && !isDir) || (opts.dir && isDir)) && r.pusher([]byte(path)) {
atomic.StoreInt32(&r.event, int32(EvtReadNew))
}
}
Expand Down

0 comments on commit 628105d

Please sign in to comment.