mirror of
https://github.com/transmission/transmission
synced 2024-12-26 01:27:28 +00:00
delete the old resume file after migrating to the new format
This commit is contained in:
parent
612e7221a9
commit
a08ef82039
1 changed files with 12 additions and 2 deletions
|
@ -341,10 +341,20 @@ tr_torrentLoadResume( tr_torrent * tor,
|
|||
|
||||
content = tr_loadFile( filename, &contentLen );
|
||||
benc_loaded = content && !tr_bencLoad( content, contentLen, &top, NULL );
|
||||
if( !benc_loaded ) {
|
||||
if( !benc_loaded )
|
||||
{
|
||||
tr_free( content );
|
||||
tr_tordbg( tor, "Couldn't read \"%s\"; trying old resume file format.", filename );
|
||||
return tr_fastResumeLoad( tor, fieldsToLoad, ctor );
|
||||
fieldsLoaded = tr_fastResumeLoad( tor, fieldsToLoad, ctor );
|
||||
|
||||
if( ( fieldsLoaded != 0 ) && ( fieldsToLoad == ~(uint64_t)0 ) )
|
||||
{
|
||||
tr_torrentSaveResume( tor );
|
||||
tr_fastResumeRemove( tor );
|
||||
tr_tordbg( tor, "Migrated resume file to \"%s\"", filename );
|
||||
}
|
||||
|
||||
return fieldsLoaded;
|
||||
}
|
||||
|
||||
tr_tordbg( tor, "Read resume file \"%s\"", filename );
|
||||
|
|
Loading…
Reference in a new issue