Closed mbait closed 5 years ago
does library work correctly in second case? I don't see some problems there.
In first case you create one file. Library detects it and creates single-file torrent (https://wiki.theory.org/index.php/BitTorrentSpecification#Info_in_Single_File_Mode). This mode doesn't support directories. You can override this behaviour. Specify root directory name via setDirectoryName
method. Then library will create multi-file torrent always. (but there was a bug. I fixed it. update library:) )
result code for first case:
new MetadataBuilder()
.setDirectoryName("data")
.addDataSource(new ByteArrayInputStream(new byte[]{1, 2}), "BINANCE/.empty", true)
.buildBinary()
qbittorrent client opens created .torrent file correctly
Yes, the library worked correctly in the second case, I included it to show the discrepancy between the two generated files. To make it clear, in both cases (single file torrent and multiple files torrent) I called setDirectoryName()
and in both cases I expected the generated torrent file to preserve the directory structure. The problem was that in the single file torrent case the generated torrent file contained only one file at the root whose name was the value that I passed to setDirectoryName()
. If you fixed that, then feel free to close the issue.
yes, it's fixed, thanks you!
To reproduce create a .torrent file with the means of ttorrent (
TorrentCreator
orTorrentMetadataBuilder
), that has at least one nested directory, so that the layout is:In that case my .torrent file contained root-directory as if it had been a file rather than a directory. Below are what Transmission shows when the generated .torrent files are opened with it: