add windows fix

This commit is contained in:
Shreyas Goenka 2023-06-15 19:31:22 +02:00
parent a17876480a
commit e101f92016
No known key found for this signature in database
GPG Key ID: 92A07DF49CCB0622
1 changed files with 6 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import (
"io/fs" "io/fs"
"os" "os"
"path/filepath" "path/filepath"
"runtime"
"golang.org/x/exp/slices" "golang.org/x/exp/slices"
) )
@ -17,6 +18,11 @@ type LocalClient struct {
} }
func NewLocalClient(root string) (Filer, error) { func NewLocalClient(root string) (Filer, error) {
if runtime.GOOS == "windows" && root == "/" {
// Windows paths require a drive specified. This allows use to create
// local filers at the root of a windows file system
return &LocalClient{root: NewRootPath("")}, nil
}
return &LocalClient{ return &LocalClient{
root: NewRootPath(root), root: NewRootPath(root),
}, nil }, nil