aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/os/file_windows.go
diff options
context:
space:
mode:
authorleongross <[email protected]>2024-08-02 08:22:46 -0700
committerGitHub <[email protected]>2024-08-02 17:22:46 +0200
commita8a532f9d6201d76f7177e30b9abd367c37c1000 (patch)
tree010eb69b94357a0e752ce9bc5aadd732803f8bbc /src/os/file_windows.go
parent417a26d20c23ea0aaa8f95325bb30172b3e3e9e9 (diff)
downloadtinygo-a8a532f9d6201d76f7177e30b9abd367c37c1000.tar.gz
tinygo-a8a532f9d6201d76f7177e30b9abd367c37c1000.zip
os: add file.Truncate
Diffstat (limited to 'src/os/file_windows.go')
-rw-r--r--src/os/file_windows.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/os/file_windows.go b/src/os/file_windows.go
index 70f3a3dd0..5860c76b0 100644
--- a/src/os/file_windows.go
+++ b/src/os/file_windows.go
@@ -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 {