From 51a61bc1dabfd92f2b647d47bdff692a23c47d4d Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 21 Sep 2010 16:58:15 +0000 Subject: [PATCH] (trunk libT) #3562 ".torrent files are created incorrectly when the content is a single file inside a subdirectory" -- fixed. --- libtransmission/makemeta.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libtransmission/makemeta.c b/libtransmission/makemeta.c index 691cdbc6f..5c75f3a2d 100644 --- a/libtransmission/makemeta.c +++ b/libtransmission/makemeta.c @@ -336,12 +336,15 @@ makeInfoDict( tr_benc * dict, { uint8_t * pch; char * base; + const tr_bool single_file_mode = ( builder->fileCount == 1 ) && ( strchr( builder->files[0].filename, '/' ) == NULL ); tr_bencDictReserve( dict, 5 ); - if( builder->fileCount == 1 ) + if( single_file_mode ) + { tr_bencDictAddInt( dict, "length", builder->files[0].size ); - else + } + else /* multiple file mode */ { uint32_t i; tr_benc * list = tr_bencDictAddList( dict, "files",