jscancella/bagging

Saving extra tag files in directory (not in bag itself!)

Closed this issue · 2 comments

When submitting an issue please include:

  • a small code example showing the incorrect behavior
    BagBuilder builder = new BagBuilder();
    builder.addAlgorithm("md5")
    .addMetadata("foo", "bar")
    .addPayloadFile(payloadFiles)
    .addTagFile(Paths.get(absolute_dir + "/import/meta"))
    .bagLocation(Paths.get(absolute_dir + "/export/bag)
    .write();

  • the expected behavior
    Structure of Bag MUST be
    data
    meta (with files for example: mods.xml, rights.xml)
    bag-info.txt
    bagit.txt
    manifest-md5.txt
    tagmanifest-md5.txt (Must include: xxxxxxxxxxxxxxxxxxxxxxxx meta/mods.xml)
    (Must include: xxxxxxxxxxxxxxxxxxxxxxxx meta/rights.xml)

  • the actual behavior
    Structure of Bag INCORRECT
    data
    mods.xml
    rights.xml
    bag-info.txt
    bagit.txt
    manifest-md5.txt
    tagmanifest-md5.txt

  • the operating system being used, and its version
    debian 10

  • version of Bagging being used
    4.2

Need to add a check on line https://github.com/jscancella/bagging/blob/master/src/main/java/com/github/jscancella/domain/BagBuilder.java#L179
If it is a directory, then it should be builder.addFile(tagFile, rootDir.relativize(tagFile)); or something like that. Be sure to add a test case for this!

This should be fixed in version 4.3