Files
wazero/internal/platform/open_file_js.go
Crypt Keeper e5dc733df7 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>
2023-05-04 07:05:40 +08:00

20 lines
393 B
Go

package platform
import (
"io/fs"
"os"
"syscall"
)
// See the comments on the same constants in open_file_windows.go
const (
O_DIRECTORY = 1 << 29
O_NOFOLLOW = 1 << 30
)
func OpenFile(path string, flag int, perm fs.FileMode) (fs.File, syscall.Errno) {
flag &= ^(O_DIRECTORY | O_NOFOLLOW) // erase placeholders
f, err := os.OpenFile(path, flag, perm)
return f, UnwrapOSError(err)
}