mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-16 02:33:28 +00:00
os, syscall: implement Stat and Lstat
File.Stat is left as a stub for now. Tests are a bit stubbed down because os.ReadDir, os.Symlink, and t.TempDir are not yet (fully) implemented. TODO: reimport tests from upstream as those materialize.
This commit is contained in:
@@ -171,11 +171,6 @@ func (f *File) Stat() (FileInfo, error) {
|
||||
return nil, &PathError{"stat", f.name, ErrNotImplemented}
|
||||
}
|
||||
|
||||
// Sync is a stub, not yet implemented
|
||||
func (f *File) Sync() error {
|
||||
return ErrNotImplemented
|
||||
}
|
||||
|
||||
func (f *File) SyscallConn() (syscall.RawConn, error) {
|
||||
return nil, ErrNotImplemented
|
||||
}
|
||||
@@ -190,16 +185,6 @@ func (f *File) Truncate(size int64) error {
|
||||
return &PathError{"truncate", f.name, ErrNotImplemented}
|
||||
}
|
||||
|
||||
const (
|
||||
PathSeparator = '/' // OS-specific path separator
|
||||
PathListSeparator = ':' // OS-specific path list separator
|
||||
)
|
||||
|
||||
// IsPathSeparator reports whether c is a directory separator character.
|
||||
func IsPathSeparator(c uint8) bool {
|
||||
return PathSeparator == c
|
||||
}
|
||||
|
||||
// PathError records an error and the operation and file path that caused it.
|
||||
// TODO: PathError moved to io/fs in go 1.16 and left an alias in os/errors.go.
|
||||
// Do the same once we drop support for go 1.15.
|
||||
@@ -245,16 +230,6 @@ const (
|
||||
O_TRUNC int = syscall.O_TRUNC
|
||||
)
|
||||
|
||||
// Stat is a stub, not yet implemented
|
||||
func Stat(name string) (FileInfo, error) {
|
||||
return nil, &PathError{"stat", name, ErrNotImplemented}
|
||||
}
|
||||
|
||||
// Lstat is a stub, not yet implemented
|
||||
func Lstat(name string) (FileInfo, error) {
|
||||
return nil, &PathError{"lstat", name, ErrNotImplemented}
|
||||
}
|
||||
|
||||
func Getwd() (string, error) {
|
||||
return syscall.Getwd()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user