Changeset 10109
- Timestamp:
- Feb 6, 2010, 5:22:27 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/torrent-magnet.c
r10084 r10109 13 13 #include <assert.h> 14 14 #include <event.h> /* struct evbuffer */ 15 #include <stdio.h> /* remove() */ 15 16 16 17 #include "transmission.h" … … 19 20 #include "magnet.h" 20 21 #include "metainfo.h" 22 #include "resume.h" 21 23 #include "torrent.h" 22 24 #include "torrent-magnet.h" … … 192 194 if(( metainfoParsed = !err )) 193 195 { 194 /* yay we have bencoded metainfo... merge it into our .torr net file */196 /* yay we have bencoded metainfo... merge it into our .torrent file */ 195 197 tr_benc newMetainfo; 196 const char * path = tor->info.torrent; 198 char * path = tr_strdup( tor->info.torrent ); 199 197 200 if( !tr_bencLoadFile( &newMetainfo, TR_FMT_BENC, path ) ) 198 201 { … … 200 203 tr_benc * tmp; 201 204 205 /* remove any old .torrent and .resume files */ 206 remove( path ); 207 tr_torrentRemoveResume( tor ); 208 202 209 dbgmsg( tor, "Saving completed metadata to \"%s\"", path ); 203 210 assert( !tr_bencDictFindDict( &newMetainfo, "info", &tmp ) ); 204 211 tr_bencMergeDicts( tr_bencDictAddDict( &newMetainfo, "info", 0 ), &infoDict ); 205 tr_bencToFile( &newMetainfo, TR_FMT_BENC, path );206 212 207 213 success = tr_metainfoParse( tor->session, &newMetainfo, &tor->info, … … 211 217 assert( success ); 212 218 219 /* save the new .torrent file */ 220 tr_bencToFile( &newMetainfo, TR_FMT_BENC, tor->info.torrent ); 221 tr_sessionSetTorrentFile( tor->session, tor->info.hashString, tor->info.torrent ); 213 222 tr_torrentGotNewInfoDict( tor ); 214 223 tr_torrentSetDirty( tor ); … … 218 227 219 228 tr_bencFree( &infoDict ); 229 tr_free( path ); 220 230 } 221 231 }
Note: See TracChangeset
for help on using the changeset viewer.