Fix parent not present on Windows

This will (in some cases?) `syscall.ENOTDIR`.

Fixes #86
This commit is contained in:
Bjørn Erik Pedersen 2016-04-27 09:25:23 +02:00
parent 5dbffb6d3a
commit eb0cc807c2
1 changed files with 2 additions and 2 deletions

View File

@ -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