diff --git a/basepath.go b/basepath.go index 616ff8f..584320a 100644 --- a/basepath.go +++ b/basepath.go @@ -30,7 +30,9 @@ type BasePathFile struct { func (f *BasePathFile) Name() string { sourcename := f.File.Name() - return strings.TrimPrefix(sourcename, filepath.Clean(f.path)) + sourcename = strings.TrimPrefix(sourcename, filepath.VolumeName(sourcename)) + sourcename = strings.TrimPrefix(sourcename, filepath.Clean(f.path)) + return sourcename } func NewBasePathFs(source Fs, path string) Fs { diff --git a/composite_test.go b/composite_test.go index 3682c3c..96f45ef 100644 --- a/composite_test.go +++ b/composite_test.go @@ -479,7 +479,7 @@ func TestUnionFileReaddirAskForTooMany(t *testing.T) { overlay := &MemMapFs{} for i := 0; i < 5; i++ { - WriteFile(base, fmt.Sprintf("file%d.txt", i), []byte("afero"), 0777) + WriteFile(base, fmt.Sprintf("/file%d.txt", i), []byte("afero"), 0777) } ufs := &CopyOnWriteFs{base: base, layer: overlay} diff --git a/memmap.go b/memmap.go index b2dca4f..164ca5a 100644 --- a/memmap.go +++ b/memmap.go @@ -191,7 +191,7 @@ func normalizePath(path string) (string, error) { case FilePathSeparator: return rootAbs, nil default: - return path, nil + return filepath.Abs(path) } }