(trunk cli) #4585 "use full path when download directory is specified" -- fix with patch by dyogene
This commit is contained in:
parent
ae972b50c4
commit
ff8a086fe3
12
cli/cli.c
12
cli/cli.c
|
@ -226,6 +226,8 @@ main( int argc, char ** argv )
|
|||
const char * configDir;
|
||||
uint8_t * fileContents;
|
||||
size_t fileLength;
|
||||
const char * str;
|
||||
char buf[TR_PATH_MAX];
|
||||
|
||||
tr_formatter_mem_init( MEM_K, MEM_K_STR, MEM_M_STR, MEM_G_STR, MEM_T_STR );
|
||||
tr_formatter_size_init( DISK_K,DISK_K_STR, DISK_M_STR, DISK_G_STR, DISK_T_STR );
|
||||
|
@ -257,6 +259,16 @@ main( int argc, char ** argv )
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if( tr_bencDictFindStr( &settings, TR_PREFS_KEY_DOWNLOAD_DIR, &str ) ) {
|
||||
str = tr_realpath( str, buf );
|
||||
if( str != NULL ) {
|
||||
tr_bencDictAddStr( &settings, TR_PREFS_KEY_DOWNLOAD_DIR, str );
|
||||
} else {
|
||||
fprintf( stderr, "Download directory does not exist!\n" );
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
h = tr_sessionInit( "cli", configDir, false, &settings );
|
||||
|
||||
ctor = tr_ctorNew( h );
|
||||
|
|
Loading…
Reference in New Issue