Changeset 11576


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

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

Location:
branches/2.1x
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/2.1x/NEWS

    r11552 r11576  
    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.13 (2010/12/09) ===
  • branches/2.1x/gtk/add-dialog.c

    r11350 r11576  
    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.1x/libtransmission/torrent.c

    r11301 r11576  
    26952695};
    26962696
    2697 static tr_bool
    2698 isSameLocation( const char * path1, const char * path2 )
    2699 {
    2700     struct stat s1, s2;
    2701     const int err1 = stat( path1, &s1 );
    2702     const int err2 = stat( path2, &s2 );
    2703 
    2704     if( !err1 && !err2 ) {
    2705         tr_dbg( "path1 dev:inode is %"PRIu64":%"PRIu64"; "
    2706                 "path2 dev:inode is %"PRIu64":%"PRIu64,
    2707                 (uint64_t)s1.st_dev, (uint64_t)s1.st_ino,
    2708                 (uint64_t)s2.st_dev, (uint64_t)s2.st_ino );
    2709         return ( s1.st_dev == s2.st_dev )
    2710             && ( s1.st_ino == s2.st_ino );
    2711     }
    2712 
    2713     /* either one, or the other, or both don't exist... */
    2714     tr_dbg( "stat(%s) returned %d\n", path1, err1 );
    2715     tr_dbg( "stat(%s) returned %d\n", path2, err2 );
    2716     return FALSE;
    2717 }
    2718 
    27192697static void
    27202698setLocation( void * vdata )
     
    27352713    tr_mkdirp( location, 0777 );
    27362714
    2737     if( !isSameLocation( location, tor->currentDir ) )
     2715    if( !tr_is_same_file( location, tor->currentDir ) )
    27382716    {
    27392717        tr_file_index_t i;
  • branches/2.1x/libtransmission/utils.c

    r11490 r11576  
    15791579}
    15801580
     1581tr_bool
     1582tr_is_same_file( const char * filename1, const char * filename2 )
     1583{
     1584    struct stat sb1, sb2;
     1585
     1586    return !stat( filename1, &sb1 )
     1587        && !stat( filename2, &sb2 )
     1588        && ( sb1.st_dev == sb2.st_dev )
     1589        && ( sb1.st_ino == sb2.st_ino );
     1590}
     1591
    15811592/***
    15821593****
  • branches/2.1x/libtransmission/utils.h

    r11490 r11576  
    507507                 tr_bool * renamed ) TR_GNUC_NONNULL(1,2);
    508508
     509/** @brief Test to see if the two filenames point to the same file. */
     510tr_bool tr_is_same_file( const char * filename1, const char * filename2 );
     511
    509512/** @brief convenience function to remove an item from an array */
    510513void tr_removeElementFromArray( void         * array,
Note: See TracChangeset for help on using the changeset viewer.