diff --git a/core/utilitiesMisc.go b/core/utilitiesMisc.go index 690ceed..9bee40f 100644 --- a/core/utilitiesMisc.go +++ b/core/utilitiesMisc.go @@ -37,7 +37,10 @@ func EntryRefresh(oldRCWPassphrase, newRCWPassphrase []byte, removeOldDir bool) return errors.New("unable to refresh entries: \"" + global.EntryRoot + "-old\" already exists") } } - os.RemoveAll(global.EntryRoot + dirEnd) + err := os.RemoveAll(global.EntryRoot + dirEnd) + if err != nil { + return errors.New("unable to remove \"" + global.EntryRoot + dirEnd + "\": " + err.Error()) + } } // create output directory structure (global.EntryRoot + "-new"/*) diff --git a/libmuttonserver.go b/libmuttonserver.go index 3fa4401..8034183 100644 --- a/libmuttonserver.go +++ b/libmuttonserver.go @@ -38,7 +38,7 @@ func main() { case "fetch": // print all information needed for syncing to stdout for interpretation by the client // stdin[0] is expected to be the device ID - _ = syncserver.GetRemoteDataFromServer(stdin[0]) + syncserver.GetRemoteDataFromServer(stdin[0]) case "rename": // move an entry to a new location before using fallthrough to add its previous iteration to the deletions directory // stdin[0] is evaluated after fallthrough diff --git a/syncserver/server.go b/syncserver/server.go index a9f55af..8bc3e3b 100644 --- a/syncserver/server.go +++ b/syncserver/server.go @@ -1,7 +1,6 @@ package syncserver import ( - "errors" "fmt" "os" "strings" @@ -14,16 +13,10 @@ import ( // GetRemoteDataFromServer prints to stdout the remote entries, mod times, folders, and deletions. // Lists in output are separated by FSSpace. // Output is meant to be captured over SSH for interpretation by the client. -func GetRemoteDataFromServer(clientDeviceID string) error { - entryList, dirList, err := synccommon.WalkEntryDir() - if err != nil { - return errors.New("unable to walk entry directory: " + err.Error()) - } +func GetRemoteDataFromServer(clientDeviceID string) { + entryList, dirList, _ := synccommon.WalkEntryDir() modList := synccommon.GetModTimes(entryList) - deletionsList, err := os.ReadDir(global.ConfigDir + global.PathSeparator + "deletions") - if err != nil { - return errors.New("unable to read deletions directory: " + err.Error()) - } + deletionsList, _ := os.ReadDir(global.ConfigDir + global.PathSeparator + "deletions") // print the current UNIX timestamp to stdout fmt.Print(time.Now().Unix()) @@ -60,5 +53,4 @@ func GetRemoteDataFromServer(clientDeviceID string) error { _ = os.Remove(global.ConfigDir + global.PathSeparator + "deletions" + global.PathSeparator + deletion.Name()) // error ignored; function not run from a user-facing argument and thus the error would not be visible } } - return nil }