mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-16 02:33:28 +00:00
os: add file.Truncate
This commit is contained in:
@@ -59,6 +59,10 @@ func Pipe() (r *File, w *File, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (f *unixFileHandle) Truncate(size int64) error {
|
||||
return ErrNotImplemented
|
||||
}
|
||||
|
||||
func tempDir() string {
|
||||
n := uint32(syscall.MAX_PATH)
|
||||
for {
|
||||
@@ -106,6 +110,16 @@ func (f unixFileHandle) Sync() error {
|
||||
return ErrNotImplemented
|
||||
}
|
||||
|
||||
func (f *File) Truncate(size int64) error {
|
||||
var err error
|
||||
if f.handle == nil {
|
||||
err = ErrClosed
|
||||
} else {
|
||||
err = ErrNotImplemented
|
||||
}
|
||||
return &PathError{Op: "truncate", Path: f.name, Err: err}
|
||||
}
|
||||
|
||||
// isWindowsNulName reports whether name is os.DevNull ('NUL') on Windows.
|
||||
// True is returned if name is 'NUL' whatever the case.
|
||||
func isWindowsNulName(name string) bool {
|
||||
|
||||
Reference in New Issue
Block a user