Commit Graph

12 Commits

Author SHA1 Message Date
Bjørn Erik Pedersen 5e9f8ecaa4 Return os.ErrExist from CopyOnWriteFs.Mkdir/MkdirAll
Before this commit, `CopyOnWriteFs` would return `syscall.EEXIST` in `Mkdir` and `MkdirAll` when a directory already exists.

The main problem with this is that `os.IsExist` returns `false` for that error on Windows.

These methods now return `os.ErrExist`, which is in line with how the other file systems behave.

Fixes #189
2018-12-17 09:55:40 +01:00
Bjørn Erik Pedersen b6dc11ece0
Make the merge func in UnionFile configureable 2018-04-01 22:57:52 +02:00
Bjørn Erik Pedersen 8902da1e4d
Add an optional Lstater interface
The interface has one method returning the `FileInfo` and a flag telling if `Lstat` was called or not.

```go
type Lstater interface {
    LstatIfPossible(name string) (os.FileInfo, bool, error)
}
```

`Lstat` is currently only supported by the `OsFs`, but since that `Fs` can be used in others, they will also support it by proxy.

But not always, so hence this optional interface.

The interface is in this commit implemented for:

* BasePathFs
* OsFs
* CopyOnWriteFs
* ReadOnlyFs

Fixes #75
2018-04-01 22:57:51 +02:00
Bjørn Erik Pedersen 8d919cbe7e
Check for ErrNotExist in CopyOnWriteFs.Stat
Fixes #144
2017-11-12 17:05:09 +01:00
Bjørn Erik Pedersen eb0cc807c2 Fix parent not present on Windows
This will (in some cases?) `syscall.ENOTDIR`.

Fixes #86
2016-04-27 09:25:23 +02:00
Martin Bertschler 8404a5e8bf don't return error in CopyOnWriteFs OpenFile if it is a not exist error
fixes #78
2016-04-20 14:30:10 +02:00
Tatsushi Demachi 3bf3fe3a71 Fix CopyOnWriteFs Stat to handle *os.PathError
CopyOnWriteFs Stat function only checks its base file system's file or
directory when its layer file system returns Stat error but if the layer
file system type is OsFs, it returns *os.PathError not syscall.ENOENT so
in this case, the base file system's file or directory is never checked.

This fixes the behavior above by expanding *os.PathError and repacking
the error code if the error type is *os.PathError.
2016-01-31 23:16:38 +09:00
Hanno Hecker 1f64d06ebe fix isBaseFile 2016-01-25 14:05:49 -05:00
Hanno Hecker d660f82c74 remove MemMepFs limitation 2016-01-25 14:05:49 -05:00
Steve Francia 9383100264 rewrite logic of CoW.Open() with commentary 2016-01-25 14:02:30 -05:00
Steve Francia 2ec8b79d61 Make OsFs.Open interoperable with others (with tests confirming) 2016-01-13 16:37:11 -05:00
Steve Francia 5c392cd048 Update filenames to reflect new names 2016-01-11 21:44:01 -05:00