Formally now sync supports file and directories mix-match
This commit is contained in:
@@ -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
@@ -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))}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user