Changeset 8775


Ignore:
Timestamp:
Jul 3, 2009, 2:31:31 PM (13 years ago)
Author:
charles
Message:

(trunk libT) #2263: Night of the Living Dead (removed and deleted torrents keep coming back)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/metainfo.c

    r8689 r8775  
    5858
    5959static char*
    60 getOldTorrentFilename( const tr_session * session,
    61                        const tr_info *   inf )
    62 {
    63     char *            ret;
    64     struct evbuffer * buf = evbuffer_new( );
    65 
    66     evbuffer_add_printf( buf, "%s%c%s", tr_getTorrentDir( session ),
    67                          TR_PATH_DELIMITER,
    68                          inf->hashString );
    69     if( session->tag )
    70         evbuffer_add_printf( buf, "-%s", session->tag );
    71 
    72     ret = tr_strndup( EVBUFFER_DATA( buf ), EVBUFFER_LENGTH( buf ) );
    73     evbuffer_free( buf );
    74     return ret;
     60getOldTorrentFilename( const tr_session * session, const tr_info * inf )
     61{
     62    int i;
     63    const char * tags[] = { "beos", "cli", "daemon", "gtk", "macosx", "wx" };
     64    const int tagCount = 6;
     65    char * path;
     66    struct stat sb;
     67
     68    for( i=0; i<tagCount; ++i ) {
     69        path = tr_strdup_printf( "%s%c%s-%s", tr_getTorrentDir( session ), '/', inf->hashString, tags[i] );
     70        if( !stat( path, &sb ) && ( ( sb.st_mode & S_IFMT ) == S_IFREG ) )
     71            return path;
     72        tr_free( path );
     73    }
     74
     75    path = tr_buildPath( tr_getTorrentDir( session ), inf->hashString, NULL );
     76    if( !stat( path, &sb ) && ( ( sb.st_mode & S_IFMT ) == S_IFREG ) )
     77        return path;
     78    tr_free( path );
     79
     80    return NULL;
    7581}
    7682
Note: See TracChangeset for help on using the changeset viewer.