From eb0cc807c28245e500631c2d261d29e9daf37bc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Wed, 27 Apr 2016 09:25:23 +0200 Subject: [PATCH] Fix parent not present on Windows This will (in some cases?) `syscall.ENOTDIR`. Fixes #86 --- copyOnWriteFs.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/copyOnWriteFs.go b/copyOnWriteFs.go index fa0c936..ed692ae 100644 --- a/copyOnWriteFs.go +++ b/copyOnWriteFs.go @@ -32,7 +32,7 @@ func (u *CopyOnWriteFs) isBaseFile(name string) (bool, error) { _, err := u.base.Stat(name) if err != nil { 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 } } @@ -80,7 +80,7 @@ func (u *CopyOnWriteFs) Stat(name string) (os.FileInfo, error) { if e, ok := err.(*os.PathError); ok { err = e.Err } - if err == syscall.ENOENT { + if err == syscall.ENOENT || err == syscall.ENOTDIR { return u.base.Stat(name) } return nil, origErr