We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4ec1e4e commit d0bfc3bCopy full SHA for d0bfc3b
file.go
@@ -135,13 +135,15 @@ func Copy(src, dest string) error {
135
*/
136
func Rename(src, dest string) error {
137
if err := os.Rename(src, dest); err != nil {
138
- if err.Error() != `invalid cross-device link` {
+ if !strings.HasSuffix(err.Error(), `invalid cross-device link`) {
139
return err
140
}
141
142
err := Copy(src, dest)
143
if err != nil {
144
- return err
+ if !strings.HasSuffix(err.Error(), `operation not permitted`) {
145
+ return err
146
+ }
147
148
// The copy was successful, so now delete the original file
149
err = os.Remove(src)
0 commit comments