Changeset 11575


Ignore:
Timestamp:
Dec 22, 2010, 7:06:00 AM (11 years ago)
Author:
charles
Message:

(2.0x) backport r11574 from #3844 "Error popup when adding a relative path"

Location:
branches/2.0x
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0x/NEWS

    r11551 r11575  
    88  * backport r11545 from #3834 "'Origin' field in Torrent Properties dialog should be ellipsized"
    99  * backport r11511 from #3719 "handle API changes to libnotify"
     10  * backport r11574 from #3844 "Error popup when adding a relative path"
    1011
    1112=== Transmission 2.05 (2010/12/05) ===
  • branches/2.0x/gtk/add-dialog.c

    r11460 r11575  
    1616#include <string.h>
    1717
     18#include <libtransmission/transmission.h>
     19#include <libtransmission/utils.h> /* tr_is_same_file() */
     20
    1821#include "add-dialog.h"
    1922#include "conf.h"
     
    188191        tr_torrent * torrent;
    189192
    190         if( filename && ( !data->filename || strcmp( filename, data->filename ) ) )
     193        if( filename && ( !data->filename || !tr_is_same_file( filename, data->filename ) ) )
    191194        {
    192195            g_free( data->filename );
     
    222225    char * fname = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( b ) );
    223226
    224     if( fname && ( !data->downloadDir || strcmp( fname, data->downloadDir ) ) )
     227    if( fname && ( !data->downloadDir || !tr_is_same_file( fname, data->downloadDir ) ) )
    225228    {
    226229        g_free( data->downloadDir );
  • branches/2.0x/libtransmission/torrent.c

    r11470 r11575  
    25212521};
    25222522
    2523 static tr_bool
    2524 isSameLocation( const char * path1, const char * path2 )
    2525 {
    2526     struct stat s1, s2;
    2527     const int err1 = stat( path1, &s1 );
    2528     const int err2 = stat( path2, &s2 );
    2529 
    2530     if( !err1 && !err2 ) {
    2531         tr_dbg( "path1 dev:inode is %"PRIu64":%"PRIu64"; "
    2532                 "path2 dev:inode is %"PRIu64":%"PRIu64,
    2533                 (uint64_t)s1.st_dev, (uint64_t)s1.st_ino,
    2534                 (uint64_t)s2.st_dev, (uint64_t)s2.st_ino );
    2535         return ( s1.st_dev == s2.st_dev )
    2536             && ( s1.st_ino == s2.st_ino );
    2537     }
    2538 
    2539     /* either one, or the other, or both don't exist... */
    2540     tr_dbg( "stat(%s) returned %d\n", path1, err1 );
    2541     tr_dbg( "stat(%s) returned %d\n", path2, err2 );
    2542     return FALSE;
    2543 }
    2544 
    25452523static void
    25462524setLocation( void * vdata )
     
    25612539    tr_mkdirp( location, 0777 );
    25622540
    2563     if( !isSameLocation( location, tor->currentDir ) )
     2541    if( !tr_is_same_file( location, tor->currentDir ) )
    25642542    {
    25652543        tr_file_index_t i;
  • branches/2.0x/libtransmission/utils.c

    r11474 r11575  
    15031503}
    15041504
     1505tr_bool
     1506tr_is_same_file( const char * filename1, const char * filename2 )
     1507{
     1508    struct stat sb1, sb2;
     1509
     1510    return !stat( filename1, &sb1 )
     1511        && !stat( filename2, &sb2 )
     1512        && ( sb1.st_dev == sb2.st_dev )
     1513        && ( sb1.st_ino == sb2.st_ino );
     1514}
     1515
    15051516/***
    15061517****
  • branches/2.0x/libtransmission/utils.h

    r10964 r11575  
    511511                 tr_bool * renamed ) TR_GNUC_NONNULL(1,2);
    512512
     513/** @brief Test to see if the two filenames point to the same file. */
     514tr_bool tr_is_same_file( const char * filename1, const char * filename2 );
     515
    513516/** @brief convenience function to remove an item from an array */
    514517static inline void tr_removeElementFromArray( void   * array,
Note: See TracChangeset for help on using the changeset viewer.