Changeset 13030


Ignore:
Timestamp:
Oct 25, 2011, 4:07:56 PM (11 years ago)
Author:
jordan
Message:

(trunk cli) #4585 "use full path when download directory is specified" -- fix with patch by dyogene

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cli/cli.c

    r12223 r13030  
    227227    uint8_t     * fileContents;
    228228    size_t        fileLength;
     229    const char  * str;
     230    char          buf[TR_PATH_MAX];
    229231
    230232    tr_formatter_mem_init( MEM_K, MEM_K_STR, MEM_M_STR, MEM_G_STR, MEM_T_STR );
     
    256258        fprintf( stderr, "No torrent specified!\n" );
    257259        return EXIT_FAILURE;
     260    }
     261
     262    if( tr_bencDictFindStr( &settings, TR_PREFS_KEY_DOWNLOAD_DIR, &str ) ) {
     263        str = tr_realpath( str, buf );
     264        if( str != NULL ) {
     265            tr_bencDictAddStr( &settings, TR_PREFS_KEY_DOWNLOAD_DIR, str );
     266        } else {
     267            fprintf( stderr, "Download directory does not exist!\n" );
     268            return EXIT_FAILURE;
     269        }
    258270    }
    259271
Note: See TracChangeset for help on using the changeset viewer.