mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-04 11:07:46 +00:00
a545f17d2e
This adds true GOOS=wasip1 support in addition to our existing -target=wasi support. The old support for WASI isn't removed, but should be treated as deprecated and will likely be removed eventually to reduce the test burden.
27 lines
503 B
Go
27 lines
503 B
Go
//go:build !(baremetal || (wasm && !wasip1))
|
|
|
|
// This file assumes there is a libc available that runs on a real operating
|
|
// system.
|
|
|
|
package syscall
|
|
|
|
const pathMax = 1024
|
|
|
|
func Getwd() (string, error) {
|
|
var buf [pathMax]byte
|
|
s := libc_getcwd(&buf[0], uint(len(buf)))
|
|
if s == nil {
|
|
return "", getErrno()
|
|
}
|
|
n := clen(buf[:])
|
|
if n < 1 {
|
|
return "", EINVAL
|
|
}
|
|
return string(buf[:n]), nil
|
|
}
|
|
|
|
// char *getcwd(char *buf, size_t size)
|
|
//
|
|
//export getcwd
|
|
func libc_getcwd(buf *byte, size uint) *byte
|