cmd.NewFsSrc([]string{"/path/to/file") is sending error "is a file not a directory"


#1

Hey!

Thanks for that wonderful library!
I’m trying to cat the content of a file and to do so I’m creating a fs.Fs with cmd.NewFsSrc([]string{"/path/to/file") but that func return the error “/path/to/file is a file not a directory”

The comment of that function is:
// NewFsSrc creates a new src fs from the arguments.
//
// The source can be a file or a directory - if a file then it will
// limit the Fs to a single file.

What am I doing wrong there?
Many thanks!


#2

What happens is if you get fs.ErrorIsFile you can still use the returned fs but it points to the parent directory the file is in.


#3

Ok many thanks! I just figured that I was badly using it.
Again, great library!