Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows: Error traversing the windows installed in the virtual machine #37

Closed
jgbooks opened this issue Oct 15, 2024 · 2 comments · Fixed by #38
Closed

windows: Error traversing the windows installed in the virtual machine #37

jgbooks opened this issue Oct 15, 2024 · 2 comments · Fixed by #38

Comments

@jgbooks
Copy link

jgbooks commented Oct 15, 2024

Testing the Windows system in a virtual machine environment and traversing the C:\ shows error results.

PS C:\Users\whm\Desktop> .\fastwalk_demo.exe
true \ drwxrwxrwx 4096
C:\
C:
C:/desktop.ini
C:/fastwalk_demo.exe

The program runs on the user's desktop and it only traverses the files on the user's desktop.
Here is my code:

package main

import (
	"fmt"
	"github.com/charlievieth/fastwalk"
	"io/fs"
)

func main() {
	conf := fastwalk.Config{
		Follow:  true,
		Sort:    fastwalk.SortNone,
		ToSlash: true,
	}
	err := fastwalk.Walk(&conf, "C:", func(path string, d fs.DirEntry, err error) error {
		fmt.Println(path)
		return nil
	})
	fmt.Println(err)
}
@jgbooks jgbooks changed the title Error traversing the windows installed in the virtual machine windows: Error traversing the windows installed in the virtual machine Oct 15, 2024
@skarasov
Copy link

cd c:\ goto root of c:
cd c: goto current dir on c:

and fastwalk trims last \
please see junegunn/fzf#4027

@charlievieth
Copy link
Owner

@jgbooks Thank you for reporting this. I'll take a look at it tonight / tomorrow.

charlievieth added a commit that referenced this issue Oct 25, 2024
On Windows don't attempt to clean the path argument to Walk since the
existing clean logic (cleanRootPath) transforms paths like "C:\" => "C:"
which are not equivalent.

This logic only existed to make the joining of paths simpler and should
probably be removed since we shouldn't be modifying user provided paths.

TODO: Investigate if anything relies on the current clean logic and
remove it if nothing does.

Fixes: #37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants