Formally now sync supports file and directories mix-match

This commit is contained in:
Harshavardhana
2015-07-16 20:04:46 -07:00
parent 5b60b65c08
commit 7e0fce66e7
2 changed files with 5 additions and 23 deletions
-7
View File
@@ -53,13 +53,6 @@ type copyURLs struct {
Error error
}
func (c copyURLs) IsEmpty() bool {
if c.SourceContent == nil && c.TargetContent == nil {
return true
}
return false
}
type copyURLsType uint8
const (
+5 -16
View File
@@ -17,6 +17,7 @@
package main
import (
"os"
"path/filepath"
"strings"
@@ -30,22 +31,6 @@ type syncURLs struct {
Error error `json:"-"`
}
func (s syncURLs) IsEmpty() bool {
empty := false
if s.SourceContent == nil {
empty = true
if s.TargetContents == nil {
empty = true
return empty
}
if len(s.TargetContents) > 0 && s.TargetContents[0] == nil {
empty = true
return empty
}
}
return empty
}
type syncURLsType uint8
const (
@@ -149,6 +134,10 @@ func prepareSingleSyncURLsTypeB(sourceURL string, targetURL string) syncURLs {
}
_, targetContent, err := url2Stat(targetURL)
if os.IsNotExist(iodine.ToError(err)) {
// Source and target are files. Already reduced to Type A.
return prepareSingleSyncURLsTypeA(sourceURL, targetURL)
}
if err != nil {
return syncURLs{Error: NewIodine(iodine.New(err, nil))}
}