Adds Path to platform.File and refactors tests (#1431)

Signed-off-by: Adrian Cole <adrian@tetrate.io>
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
Co-authored-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
This commit is contained in:
Crypt Keeper
2023-05-04 07:05:40 +08:00
committed by GitHub
parent cf5ebf6f6b
commit e5dc733df7
22 changed files with 215 additions and 154 deletions

View File

@@ -42,7 +42,11 @@ func (d *dirFS) Open(name string) (fs.File, error) {
// OpenFile implements FS.OpenFile
func (d *dirFS) OpenFile(path string, flag int, perm fs.FileMode) (platform.File, syscall.Errno) {
return platform.OpenFile(d.join(path), flag, perm)
f, errno := platform.OpenFile(d.join(path), flag, perm)
if errno != 0 {
return nil, errno
}
return platform.NewFsFile(path, f), 0
}
// Lstat implements FS.Lstat