feat: file copy, move and paste conflict checking

This commit is contained in:
Ramires Viana
2020-07-15 15:12:13 +00:00
parent 9a2ebbabe2
commit eed9da1471
8 changed files with 138 additions and 51 deletions

View File

@@ -2,6 +2,7 @@ package fileutils
import (
"io"
"os"
"path/filepath"
"github.com/spf13/afero"
@@ -25,7 +26,7 @@ func CopyFile(fs afero.Fs, source, dest string) error {
}
// Create the destination file.
dst, err := fs.Create(dest)
dst, err := fs.OpenFile(dest, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0775)
if err != nil {
return err
}