mirror of https://github.com/spf13/afero.git
normalizePath now always return absolute path, BasePathFs removes volume name from path
This commit is contained in:
parent
5c29dbdefd
commit
952281b34e
|
@ -30,7 +30,9 @@ type BasePathFile struct {
|
||||||
|
|
||||||
func (f *BasePathFile) Name() string {
|
func (f *BasePathFile) Name() string {
|
||||||
sourcename := f.File.Name()
|
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 {
|
func NewBasePathFs(source Fs, path string) Fs {
|
||||||
|
|
|
@ -479,7 +479,7 @@ func TestUnionFileReaddirAskForTooMany(t *testing.T) {
|
||||||
overlay := &MemMapFs{}
|
overlay := &MemMapFs{}
|
||||||
|
|
||||||
for i := 0; i < 5; i++ {
|
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}
|
ufs := &CopyOnWriteFs{base: base, layer: overlay}
|
||||||
|
|
Loading…
Reference in New Issue