Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c29b29d830 | ||
|
|
1eaf009e56 |
+1
-11
@@ -2,7 +2,6 @@ package pkg
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"fmt"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
@@ -48,14 +47,5 @@ func (f *File) Remove() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (f *File) Move(path string) error {
|
func (f *File) Move(path string) error {
|
||||||
if f.isMoved {
|
return os.Rename(f.filepath, path)
|
||||||
return fmt.Errorf("file already moved")
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := os.Rename(f.filepath, path); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
f.isMoved = true
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user