Skip to content

Commit

Permalink
fix: ignore EXDEV error in file moving
Browse files Browse the repository at this point in the history
  • Loading branch information
anmitsu committed Nov 23, 2021
1 parent cb223be commit 6d7dcc5
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions app/filectrl.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"path/filepath"
"regexp"
"strings"
"syscall"
"time"

"github.com/anmitsu/goful/filer"
Expand Down Expand Up @@ -464,11 +463,7 @@ func copyTimes(src, dst string) error {

func moveFile(src, dst string) error {
if err := os.Rename(src, dst); err != nil {
if err.(*os.LinkError).Err == syscall.EXDEV { // cross-device link
if err := copyFileAfterRemove(src, dst); err != nil {
return err
}
} else {
if err := copyFileAfterRemove(src, dst); err != nil {
return err
}
}
Expand Down

0 comments on commit 6d7dcc5

Please sign in to comment.