Commit Graph

8 Commits

Author SHA1 Message Date
Oliver Bone 428eac8624
Add Chmod() method to File
`os.File` offers a `Chmod()` method. This is often safer and more direct
to use than `os.Chmod()` because it operates on an open file descriptor
rather than having to lookup the file by name. Without this, it's
possible for the target file to be renamed, in which case an
`os.Chmod()` would either fail or apply to any file that's taken its
place.

Therefore, add the `Chmod()` method to the `File` interface, and
implement it for all `File` implementations. The bulk of this change is
in `MemMapFs`, which required moving the chmod functionality down into
the `mem` package so that it can be shared between both `mem.File` and
`MemMapFs`.
2022-05-20 14:02:18 +01:00
John Starich e76d1f3bb5 Fix panic when not filling up zipfs's read buffer 2020-06-25 23:27:17 -05:00
Jonas Plum 5fd16ea9f1
Fix zipfs.Readdir and zipfs.Readdirnames
If count == 0 all files should be returned as of https://golang.org/pkg/os/#File.Readdir
2020-04-14 22:36:17 +02:00
Michail Kargakis 90f4ffe95f
Gofmt the project 2020-04-10 23:59:22 +02:00
Hilko Bengen 344ad9d197 Don't hide errors while reading from ZIP files 2020-03-30 15:45:29 +02:00
Hilko Bengen 72cabd552e Eliminate another root-path-related corner case 2020-03-30 14:44:04 +02:00
Hilko Bengen d5bfeca89b Work around root directory Open/Stat corner case leading to panic
See https://github.com/spf13/afero/pull/146#issuecomment-470840725
2020-03-30 14:44:04 +02:00
Hilko Bengen 4f00b06400 Add zipfs, an archive/zip-based read-only filesystem 2020-03-30 14:44:04 +02:00