Advertisement
Guest User

Untitled

a guest
Dec 15th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.15 KB | None | 0 0
  1.     std::unordered_map<std::string, std::string> inACopy;
  2.     std::unordered_map<std::string, std::string> inBCopy;
  3.     std::unordered_set<std::string> parentFolder;
  4.  
  5.     std::unordered_map<std::string, std::string> manAMap;
  6.     std::unordered_map<std::string, std::string> manBMap;
  7.  
  8.     for(auto x: manifestA) {
  9.         std::string prefix = withoutChecksum(x);
  10.         manAMap[prefix] = x;
  11.     }
  12.  
  13.     for(auto x: manifestB) {
  14.         std::string prefix = withoutChecksum(x);
  15.         manBMap[prefix] = x;
  16.     }
  17.    
  18.  
  19.     for(auto x: manifestA) {
  20.         std::string prefix = withoutChecksum(x);
  21.         if (manBMap.count(prefix)) {
  22.             // If they're the same
  23.             if (manBMap[prefix] == x) {
  24.                 // Do nothing, checksums match
  25.                 // Left in for clarity
  26.             }
  27.             else {
  28.                 // File is same, but dif checksum.
  29.                 parentFolder.insert(prefix);
  30.                 inACopy[prefix] = x;
  31.                 inBCopy[prefix] = manBMap[prefix];
  32.                
  33.             }
  34.         }
  35.         else {
  36.             // Copy x
  37.             // The entire file is only in A
  38.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement