Commit Graph

219 Commits

Author SHA1 Message Date
Illya Chekrygin e016ffbd1f
Add implementation for TempFile with wild card prefix
Signed-off-by: Illya Chekrygin <illya.chekrygin@gmail.com>
2020-01-06 22:31:16 -08:00
Cameron Moore 588a75ec4f Fix UnionFile.Readdir return when c <= 0
Update Readdir to match behavior of stdlib os package.

Fixes #197
2019-03-26 13:07:55 +01:00
Bjørn Erik Pedersen f4711e4db9 Fix missing bounds checking in UnionFile.Readdir
It will now return io.EOF at the end of the directory view.

Fixes #194
2019-01-30 09:29:40 +01:00
Bjørn Erik Pedersen a5d6946387 Return nil in CopyOnWriteFs.MkdirAll when directory exists
Fixes #191
2018-12-17 09:55:40 +01:00
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 d40851caa0
Add go.mod 2018-09-07 11:23:51 +02:00
Bjørn Erik Pedersen 787d034dfe Return error in Readdir on regular mem file
Fixes #169
2018-05-31 11:51:01 +02:00
Bjørn Erik Pedersen 63644898a8
Return os.ErrNotExist in BasePathFs on abs URLs on Windows
So it can be used in a composite filesystem.

Fixes #162
2018-04-01 22:57:52 +02: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
Martin Bertschler a880a37ed1 upgrade travis Go versions to current and previous (1.10 and 1.9), remove 1.8 2018-03-22 23:51:30 +01:00
Martin Bertschler 6e0c3784c4
Merge pull request #147 from arbelt/fix-basepathfile
fix File.Name() on BasePathFS (wrap File objects returned by BasePathFs)
2018-03-22 23:44:38 +01:00
Jamie Wilkinson bbf41cb36d Removes go 1.7 from the build matrix, adds 1.9
Travis builds are failing on go 1.7.5 because of github.com/pkg/sftp doesn't support that version anymore.
2018-02-12 03:27:14 +11:00
Bjørn Erik Pedersen bb8f1927f2
Return error instead of panic in WriteReader
See https://github.com/gohugoio/hugo/issues/4240
2018-01-15 20:27:20 +01:00
Bjørn Erik Pedersen 57afd63c68
Revert "readme: Link to release notes in Releases"
Someone else will have to do this work.

This reverts commit a43378e6c4.
2017-12-28 13:50:11 +01:00
Bjørn Erik Pedersen a43378e6c4
readme: Link to release notes in Releases
Closes #151
2017-12-28 13:31:12 +01:00
Bjørn Erik Pedersen ec3a3111d1
mem: Make the File return io.ErrUnexpectedEOF
Instead of panic when reading beyond its borders.

This is in line with how the OS File works.

Fixes #152
2017-12-28 12:02:27 +01:00
Albert Z Wang 3d990a0494 remove debug output 2017-12-12 20:08:50 -05:00
Albert Z Wang 4f332f79e7 clean paths in test comparisons 2017-11-29 14:01:03 -05:00
Albert Z Wang c5621b3590 clean basepath before stripping 2017-11-29 13:56:26 -05:00
Albert Z Wang f12a645649 add tests (thanks to @ts2909)
* copied from 6c031db617
2017-11-29 13:44:12 -05:00
Albert Z Wang 9034a12a59 add BasePathFile to fix File.Name() on BasePathFS 2017-11-29 00:20:21 -05:00
Bjørn Erik Pedersen 8d919cbe7e
Check for ErrNotExist in CopyOnWriteFs.Stat
Fixes #144
2017-11-12 17:05:09 +01:00
Martin Bertschler 5660eeed30 Merge pull request #140 from JosephSalisbury/fix-neuter-accents-godoc
Improves NeuterAccents godoc
2017-10-21 13:08:13 +02:00
Joseph Salisbury 242208d9a2
Improves NeuterAccents godoc 2017-10-13 11:08:46 +01:00
Martin Bertschler e67d870304 Merge pull request #138 from dangerousHobo/patch-1
Fix some code bugs in the README.md.
2017-10-08 20:27:26 +02:00
Martin Bertschler b48f4f807b Merge pull request #139 from snwfdhmp/patch-1
Improve code block styling in README.md
2017-10-08 18:38:47 +02:00
snwfdhmp ea5fe66f02 Minor improvement 2017-10-08 18:09:09 +02:00
Michael John 3e504d357f Fix some code bugs in the README.md. 2017-10-05 21:34:59 -04:00
Martin Bertschler 3de492c3cd Merge pull request #136 from spf13/memfs-fixes
Memfs fixes
2017-10-04 08:48:03 +02:00
Martin Bertschler 0936e8d1b2 Merge pull request #120 from thylong/master
readme: remove inferred type from AppFs declaration.
2017-10-04 01:03:46 +02:00
Martin Bertschler 84cf6dc707 set ModeDir on MkDir calls on MemMapFs
closes #118
2017-10-03 23:46:18 +02:00
Martin Bertschler 473997e418 add test that shows a bug with FileMode not being set for MemMapFs directories, clean up tests 2017-10-03 23:17:35 +02:00
Martin Bertschler 8a6ade7159 Merge pull request #135 from rodaine/cacheOnRead-NotExistsError
CacheOnReadFS: erroneous NotExists error from MemMapFS layer
2017-10-03 22:45:38 +02:00
Martin Bertschler 44971ef5a2 Merge pull request #134 from corentone/mem-races
mem/file.go - Fix some races in accessing fields of FileData
2017-10-03 22:36:30 +02:00
Corentin Debains d29940f63d mem/file.go - Fix some races in accessing fields of FileData
* Splitting SetModeTime to avoid double locking
* Adding locks all over the place.
2017-09-30 22:59:59 -07:00
Chris Roche 838d6de32d CacheOnReadFS: Use os.IsNotExist to correctly detect cache misses 2017-09-04 20:40:32 -07:00
Chris Roche 655d0bd1f1 CacheOnReadFS: erroneous NotExists error 2017-09-04 20:34:40 -07:00
Kevin Crawley ee1bd8ee15 Added glob/match support to afero 2017-09-01 15:23:52 +10:00
jszwec 36f8810e2e Fix data races in MemMapFs
Concurrent modifications of the file system while calling
ReadDir was causing data races and sometimes panics.
2017-08-25 23:32:52 +02:00
Theotime Leveque 596850cca5 readme: remove inferred type from AppFs declaration. 2017-03-25 18:31:14 -04:00
Bjørn Erik Pedersen 9be650865e travis: Bump to Go 1.7.5 and 1.8 2017-02-17 17:41:46 +01:00
Sotirios Mantziaris 72b3142684 Eliminate go vet warnings 2017-01-09 23:53:20 +01:00
Martin Bertschler 90dd71edc4 Merge pull request #113 from moorereason/iss112
Fix data races in MemMapFs.Chmod and Chtimes
2016-12-26 10:19:39 +01:00
Cameron Moore b2ec40fb24 Fix data races in MemMapFs.Chmod and Chtimes
Fixes #112
2016-12-25 23:43:06 -06:00
Martin Bertschler 2f30b2a92c Merge pull request #110 from SonOfBytes/memfs-perm-fix
Set perm in MemMapFS after OpenFile, MkDir and MkDirAll methods called
2016-12-08 19:21:42 +01:00
Martin Bertschler 8a1f1350d8 Merge pull request #99 from moorereason/unused
Remove unused code
2016-12-08 19:19:22 +01:00
Martin Bertschler 22793e5c8b Merge pull request #111 from harsimranmaan/gofmt
Keep gofmt happy
2016-12-08 19:17:24 +01:00
Harsimran Singh Maan a1903a1b07
Keep gofmt happy 2016-11-22 22:54:07 -08:00
SonOfBytes b34e0196a7 Update memmap.go
remove unnecessary comment
2016-11-22 16:54:00 +00:00