Source file
src/os/file_open_wasip1.go
1
2
3
4
5
6
7 package os
8
9 import (
10 "internal/poll"
11 "syscall"
12 )
13
14 func open(filePath string, flag int, perm uint32) (int, poll.SysFile, error) {
15 if filePath == "" {
16 return -1, poll.SysFile{}, syscall.EINVAL
17 }
18 absPath := filePath
19
20
21
22 if filePath[0] != '/' {
23 wd, err := syscall.Getwd()
24 if err != nil {
25 return -1, poll.SysFile{}, err
26 }
27 absPath = joinPath(wd, filePath)
28 }
29 fd, err := syscall.Open(absPath, flag, perm)
30 return fd, poll.SysFile{Path: absPath}, err
31 }
32
View as plain text