implement builtin copy operation

Related #61 and #113
This commit is contained in:
Gokcehan committed 2019-02-26 20:12:13 +03:00
1 parent fd1af47233
commit d6e9aece51
5 files changed
+190 -13

No files matched your search

+3 -3
View File
@@ -89,7 +89,7 @@ func shellCommand(s string, args []string) *exec.Cmd {
return exec.Command(gOpts.shell, args...)
}
func pasteCommand(list []string, dir *dir, cp bool) *exec.Cmd {
func pasteCommand(list []string, dstDir string, cp bool) *exec.Cmd {
var args []string
sh := "robocopy"
@@ -105,9 +105,9 @@ func pasteCommand(list []string, dir *dir, cp bool) *exec.Cmd {
base := filepath.Base(f)
dest := filepath.Dir(f)
if stat.IsDir() {
exec.Command(sh, append(args, f, filepath.Join(dir.path, base))...).Run()
exec.Command(sh, append(args, f, filepath.Join(dstDir, base))...).Run()
} else {
exec.Command(sh, append(args, dest, dir.path, base)...).Run()
exec.Command(sh, append(args, dest, dstDir, base)...).Run()
}
}