|
|
@ -19,22 +19,15 @@ Payloadmanifest::Payloadmanifest( string basedir ) { |
|
|
|
possible_manifest_files[alg] = "manifest-" + string_of_algorithm( alg ) + ".txt"; |
|
|
|
} |
|
|
|
for (map<checksum_algorithms, string>::iterator it=possible_manifest_files.begin(); it!=possible_manifest_files.end(); ++it) { |
|
|
|
checksum_algorithms alg = it->first; |
|
|
|
// test if file exists
|
|
|
|
string filename = basedir + it->second; |
|
|
|
fs::path p{ filename }; |
|
|
|
fs::file_status s = fs::status( p ); |
|
|
|
// cout << "path "<< p.string() << endl;
|
|
|
|
// cout << "is file: "<< fs::is_regular_file( s) << endl;
|
|
|
|
if (fs::is_regular_file( s)) { |
|
|
|
Payloadmanifest::manifest_algorithm_files[it->first] = filename; |
|
|
|
// debug
|
|
|
|
//cout << "PAYLOADMANIFEST: alg="<< it->first << " => filename=" << it->second << endl;
|
|
|
|
// cout << " alg="<< it->first << " => filename=" << Payloadmanifest::manifest_algorithm_files[it->first] << endl;
|
|
|
|
Payloadmanifest::manifest_algorithm_files[alg] = filename; |
|
|
|
} |
|
|
|
} |
|
|
|
//cout << "PAYLOADMANIFEST constructor, calling debug()" << endl;
|
|
|
|
//this->debug();
|
|
|
|
//cout << "PAYLOADMANIFEST constructor, finished" << endl;
|
|
|
|
} |
|
|
|
|
|
|
|
bool Payloadmanifest::validate() { |
|
|
@ -42,15 +35,12 @@ bool Payloadmanifest::validate() { |
|
|
|
bool tmp = Manifest::validate(); |
|
|
|
if (false == tmp) { is_valid = false; } |
|
|
|
// check if at least one payload file exist
|
|
|
|
//cout << "payload_manifest: " << this->manifest_algorithm_files.size() << endl;
|
|
|
|
if (0 == this->manifest_algorithm_files.size()) { |
|
|
|
this->log << "Bagit payloadmanifest count greater zero expected, but " << to_string(this->manifest_algorithm_files.size()) << " found" << endl; |
|
|
|
is_valid = false; |
|
|
|
} |
|
|
|
//cout << "PAYLOADMANIFEST validate, calling debug()" << endl;
|
|
|
|
//this->debug();
|
|
|
|
//cout << "PAYLOADMANIFEST validate, finished" << endl;
|
|
|
|
return is_valid; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// vim: set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab
|