mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-16 02:33:28 +00:00
os: add File.Chdir support
We should really be using syscall.Fchdir here, but this is a fix to get Go 1.24 working.
This commit is contained in:
committed by
Ron Evans
parent
c2eaa495df
commit
cdea833b5c
@@ -166,6 +166,22 @@ func (f *File) chmod(mode FileMode) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *File) chdir() error {
|
||||
if f.handle == nil {
|
||||
return ErrClosed
|
||||
}
|
||||
|
||||
// TODO: use syscall.Fchdir instead
|
||||
longName := fixLongPath(f.name)
|
||||
e := ignoringEINTR(func() error {
|
||||
return syscall.Chdir(longName)
|
||||
})
|
||||
if e != nil {
|
||||
return &PathError{Op: "chdir", Path: f.name, Err: e}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ReadAt reads up to len(b) bytes from the File starting at the given absolute offset.
|
||||
// It returns the number of bytes read and any error encountered, possibly io.EOF.
|
||||
// At end of file, Pread returns 0, io.EOF.
|
||||
|
||||
Reference in New Issue
Block a user