Factor rclone main() in preparation for tests

This commit is contained in:
Nick Craig-Wood
2014-03-27 17:26:24 +00:00
parent a628bef9c2
commit 3eda36f6da
2 changed files with 72 additions and 54 deletions
+18
View File
@@ -211,6 +211,24 @@ func checkClose(c io.Closer, err *error) {
}
}
// Work out modify window for fses passed in - sets Config.ModifyWindow
//
// This is the largest modify window of all the fses in use, and the
// user configured value
func CalculateModifyWindow(fs ...Fs) {
for _, f := range fs {
if f != nil {
precision := f.Precision()
if precision > Config.ModifyWindow {
Config.ModifyWindow = precision
}
}
}
if Config.Verbose {
log.Printf("Modify window is %s\n", Config.ModifyWindow)
}
}
// Check the two files to see if the MD5sums are the same
//
// May return an error which will already have been logged