1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-24 16:52:39 +00:00

(cli) #5212 'cli fails when download directory doesn't exist' -- fixed.

This commit is contained in:
Jordan Lee 2013-01-04 23:58:52 +00:00
parent 5b1cd134ad
commit 2e7c9e15bd

View file

@ -231,7 +231,6 @@ main (int argc, char ** argv)
uint8_t * fileContents; uint8_t * fileContents;
size_t fileLength; size_t fileLength;
const char * str; 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_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); tr_formatter_size_init (DISK_K,DISK_K_STR, DISK_M_STR, DISK_G_STR, DISK_T_STR);
@ -267,15 +266,16 @@ main (int argc, char ** argv)
if (tr_variantDictFindStr (&settings, TR_KEY_download_dir, &str, NULL)) if (tr_variantDictFindStr (&settings, TR_KEY_download_dir, &str, NULL))
{ {
str = tr_realpath (str, buf); if (!tr_fileExists (str, NULL))
tr_mkdirp (str, 0700);
if (str != NULL) if (tr_fileExists (str, NULL))
{ {
tr_variantDictAddStr (&settings, TR_KEY_download_dir, str); tr_variantDictAddStr (&settings, TR_KEY_download_dir, str);
} }
else else
{ {
fprintf (stderr, "Download directory does not exist!\n"); fprintf (stderr, "Unable to create download directory \"%s\"!\n", str);
return EXIT_FAILURE; return EXIT_FAILURE;
} }
} }