Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- std::unordered_map<std::string, std::string> inACopy;
- std::unordered_map<std::string, std::string> inBCopy;
- std::unordered_set<std::string> parentFolder;
- std::unordered_map<std::string, std::string> manAMap;
- std::unordered_map<std::string, std::string> manBMap;
- for(auto x: manifestA) {
- std::string prefix = withoutChecksum(x);
- manAMap[prefix] = x;
- }
- for(auto x: manifestB) {
- std::string prefix = withoutChecksum(x);
- manBMap[prefix] = x;
- }
- for(auto x: manifestA) {
- std::string prefix = withoutChecksum(x);
- if (manBMap.count(prefix)) {
- // If they're the same
- if (manBMap[prefix] == x) {
- // Do nothing, checksums match
- // Left in for clarity
- }
- else {
- // File is same, but dif checksum.
- parentFolder.insert(prefix);
- inACopy[prefix] = x;
- inBCopy[prefix] = manBMap[prefix];
- }
- }
- else {
- // Copy x
- // The entire file is only in A
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement