|
|
@ -1,5 +1,4 @@ |
|
|
|
#include "tagmanifest.hpp"
|
|
|
|
#include "manifest.hpp"
|
|
|
|
#include <iostream>
|
|
|
|
#include <fstream>
|
|
|
|
#include <sstream>
|
|
|
@ -30,35 +29,24 @@ Tagmanifest::Tagmanifest( string basedir ) { |
|
|
|
Tagmanifest::manifest_algorithm_files[it->first] = filename; |
|
|
|
} |
|
|
|
} |
|
|
|
this->exist_manifest_files = possible_manifest_files.empty(); |
|
|
|
} |
|
|
|
|
|
|
|
map<string,string> Tagmanifest::get_checksum_file_pairs(checksum_algorithms alg) { |
|
|
|
string filename = Tagmanifest::manifest_algorithm_files[ alg ]; |
|
|
|
map<string,string> checksum_file_pairs; |
|
|
|
cout << "using file " << filename << endl; |
|
|
|
ifstream file; |
|
|
|
file.open( filename ); |
|
|
|
if (file.is_open()) { |
|
|
|
string line; |
|
|
|
while (getline(file, line)) { |
|
|
|
stringstream line_ss ( line ); |
|
|
|
string checksum; |
|
|
|
string subfile; |
|
|
|
line_ss >> checksum; |
|
|
|
line_ss >> subfile; |
|
|
|
checksum_file_pairs[checksum]=subfile; |
|
|
|
cout << "checksum="<<checksum<<" file="<<subfile<<endl; |
|
|
|
} |
|
|
|
file.close(); |
|
|
|
} |
|
|
|
map<string,string> checksum_file_pairs = Manifest::get_checksum_file_pairs(alg); |
|
|
|
|
|
|
|
for (map<string,string>::iterator it=checksum_file_pairs.begin(); it!=checksum_file_pairs.end(); ++it) { |
|
|
|
if (it->second.find( "data/" ) == 0) { |
|
|
|
cout << "found 'data/' in the beginning of file '"<<it->second<<"' in tagmanifest file '"<< this->manifest_algorithm_files[ alg] << endl; |
|
|
|
if (it->second.find( "data/" ) == 0) { |
|
|
|
cout << "found 'data/' in the beginning of file '"<<it->second<<"' in tagmanifest file '"<< this->manifest_algorithm_files[ alg] << endl; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return checksum_file_pairs; |
|
|
|
} |
|
|
|
|
|
|
|
bool Tagmanifest::has_tagmanifest() { |
|
|
|
return this->exist_manifest_files; |
|
|
|
} |
|
|
|
|
|
|
|
// vim: set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab
|
|
|
|
|