mirror of https://github.com/spf13/afero.git
Fix parent not present on Windows
This will (in some cases?) `syscall.ENOTDIR`. Fixes #86
This commit is contained in:
parent
5dbffb6d3a
commit
eb0cc807c2
|
@ -32,7 +32,7 @@ func (u *CopyOnWriteFs) isBaseFile(name string) (bool, error) {
|
||||||
_, err := u.base.Stat(name)
|
_, err := u.base.Stat(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if oerr, ok := err.(*os.PathError); ok {
|
if oerr, ok := err.(*os.PathError); ok {
|
||||||
if oerr.Err == os.ErrNotExist || oerr.Err == syscall.ENOENT {
|
if oerr.Err == os.ErrNotExist || oerr.Err == syscall.ENOENT || oerr.Err == syscall.ENOTDIR {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ func (u *CopyOnWriteFs) Stat(name string) (os.FileInfo, error) {
|
||||||
if e, ok := err.(*os.PathError); ok {
|
if e, ok := err.(*os.PathError); ok {
|
||||||
err = e.Err
|
err = e.Err
|
||||||
}
|
}
|
||||||
if err == syscall.ENOENT {
|
if err == syscall.ENOENT || err == syscall.ENOTDIR {
|
||||||
return u.base.Stat(name)
|
return u.base.Stat(name)
|
||||||
}
|
}
|
||||||
return nil, origErr
|
return nil, origErr
|
||||||
|
|
Loading…
Reference in New Issue