Browse Source

- added missed has_bagmetadata()

- bugfix in metadata-splitting, if value is a multiline, the last newline must be removed
master
parent
commit
b9f8131e8b
1 changed files with 12 additions and 1 deletions
  1. +12
    -1
      src/lib/bagmetadata.cpp

+ 12
- 1
src/lib/bagmetadata.cpp View File

@ -61,9 +61,16 @@ Bagmetadata::Bagmetadata( string basedir ) {
// TODO: add check for results!
key = *(iter);
value = (*++iter);
// clean \n at the end of a multiline value
if (!value.empty())
{
if (value[value.length()-1] == '\n')
value.erase(value.length()-1);
}
Bagmetadata::metadata[ key ] = value;
// DEBUG:
cout << "KEY="<<key<<" value="<<value<<endl;
cout << "KEY='"<<key<<"' value='"<<value << "'" <<endl;
}
}
} else { // no file
@ -73,6 +80,10 @@ Bagmetadata::Bagmetadata( string basedir ) {
}
bool Bagmetadata::has_bagmetadata() {
return this->exist_bagmetadata_file;
}
map <string,string> Bagmetadata::get_metadata() {
return this->metadata;
}


Loading…
Cancel
Save