Merge pull request 'v0.2.1' (#4) from develop into main

Reviewed-on: #4
This commit was merged in pull request #4.
This commit is contained in:
2026-04-27 23:42:22 +05:00
+11 -1
View File
@@ -2,6 +2,7 @@ package pkg
import ( import (
"crypto/rand" "crypto/rand"
"fmt"
"os" "os"
"path/filepath" "path/filepath"
"time" "time"
@@ -47,5 +48,14 @@ func (f *File) Remove() error {
} }
func (f *File) Move(path string) error { func (f *File) Move(path string) error {
return os.Rename(f.filepath, path) if f.isMoved {
return fmt.Errorf("file already moved")
}
if err := os.Rename(f.filepath, path); err != nil {
return err
}
f.isMoved = true
return nil
} }