Initialize filer at windows root

This commit is contained in:
Shreyas Goenka 2023-06-19 01:47:46 +02:00
parent cf04ef8550
commit 7f9735df76
No known key found for this signature in database
GPG Key ID: 92A07DF49CCB0622
2 changed files with 0 additions and 37 deletions

View File

@ -3,7 +3,6 @@ package fs
import (
"context"
"fmt"
"runtime"
"strings"
"github.com/databricks/cli/cmd/root"
@ -32,16 +31,6 @@ func filerForPath(ctx context.Context, fullPath string) (filer.Filer, string, er
return f, path, err
case LocalScheme:
if runtime.GOOS == "windows" {
parts := strings.SplitN(path, ":", 2)
if len(parts) < 2 {
return nil, "", fmt.Errorf("no volume specified for path: %s", path)
}
volume := parts[0] + ":"
relPath := parts[1]
f, err := filer.NewLocalClient(volume)
return f, relPath, err
}
f, err := filer.NewLocalClient("/")
return f, path, err

View File

@ -1,26 +0,0 @@
package fs
import (
"context"
"runtime"
"testing"
"github.com/stretchr/testify/assert"
)
func TestNotSpecifyingVolumeForWindowsPathErrors(t *testing.T) {
if runtime.GOOS != "windows" {
t.Skip()
}
ctx := context.Background()
pathWithVolume := `file:/c:/foo/bar`
pathWOVolume := `file:/uno/dos`
_, path, err := filerForPath(ctx, pathWithVolume)
assert.NoError(t, err)
assert.Equal(t, `/foo/bar`, path)
_, _, err = filerForPath(ctx, pathWOVolume)
assert.Equal(t, "no volume specified for path: uno/dos", err.Error())
}