Futilities/v0.6/clade/Apps/ftm/Match/@fx/HandleFile

From WoozleCodes
Jump to navigation Jump to search

About

This one has gone through a lot of iteration because the exact sequencing of various checks and status-changes turns out to be tricky.

Terms:

  • CopyMode: means the user wants to copy files over, not just compare/check
  • CopyThis: means this file should be copied over
  • CopyDone: this file has been copied successfully (either now or earlier) and verified. If we're deleting source files, then delete the source for this one.

Flow

Check the status of B file

Does B exist?
YES: Is it the same size as A?
YES: Compare the content. Does it match?
🞛 YES: CopyDone
NO: Is it a partial copy?
🞛 YES: if CopyMode, then CopyThis (just what's left)
🞛 NO: flag as a mismatch (size and/or data)
🞛 NO: If CopyMode, then CopyThis (all of it)

CopyThis?

YES:
🞛 do the copying
🞛 verify the copy - if success, then CopyDone