Ignore:
Timestamp:
Oct 20, 2009, 4:15:10 AM (13 years ago)
Author:
charles
Message:

(trunk libT) semi-paranoid safeguard: when searching for a torrent's file, look for finished versions (normal filename) before unfinished ones (with the .part suffix). In the unlikely event of a bug where both exist, it's better for Transmission to use the finished one...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r9335 r9336  
    25682568
    25692569    if( b == NULL ) {
     2570        char * filename = tr_buildPath( tor->downloadDir, file->name, NULL );
     2571        if( fileExists( filename ) ) {
     2572            b = tor->downloadDir;
     2573            s = file->name;
     2574        }
     2575        tr_free( filename );
     2576    }
     2577
     2578    if( ( b == NULL ) && ( tor->incompleteDir != NULL ) ) {
     2579        char * filename = tr_buildPath( tor->incompleteDir, file->name, NULL );
     2580        if( fileExists( filename ) ) {
     2581            b = tor->incompleteDir;
     2582            s = file->name;
     2583        }
     2584        tr_free( filename );
     2585    }
     2586
     2587    if( ( b == NULL ) && ( tor->incompleteDir != NULL ) ) {
     2588        char * filename = tr_buildPath( tor->incompleteDir, part, NULL );
     2589        if( fileExists( filename ) ) {
     2590            b = tor->incompleteDir;
     2591            s = part;
     2592        }
     2593        tr_free( filename );
     2594    }
     2595
     2596    if( b == NULL) {
    25702597        char * filename = tr_buildPath( tor->downloadDir, part, NULL );
    25712598        if( fileExists( filename ) ) {
     
    25762603    }
    25772604
    2578     if( b == NULL ) {
    2579         char * filename = tr_buildPath( tor->downloadDir, file->name, NULL );
    2580         if( fileExists( filename ) ) {
    2581             b = tor->downloadDir;
    2582             s = file->name;
    2583         }
    2584         tr_free( filename );
    2585     }
    2586 
    2587     if( tor->incompleteDir != NULL )
    2588     {
    2589         if( b == NULL ) {
    2590             char * filename = tr_buildPath( tor->incompleteDir, part, NULL );
    2591             if( fileExists( filename ) ) {
    2592                 b = tor->incompleteDir;
    2593                 s = part;
    2594             }
    2595             tr_free( filename );
    2596         }
    2597 
    2598         if( b == NULL ) {
    2599             char * filename = tr_buildPath( tor->incompleteDir, file->name, NULL );
    2600             if( fileExists( filename ) ) {
    2601                 b = tor->incompleteDir;
    2602                 s = file->name;
    2603             }
    2604             tr_free( filename );
    2605         }
    2606     }
    2607 
    26082605    if( base != NULL )
    26092606        *base = b;
Note: See TracChangeset for help on using the changeset viewer.