Changeset 13764


Ignore:
Timestamp:
Jan 4, 2013, 11:58:52 PM (9 years ago)
Author:
jordan
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cli/cli.c

    r13683 r13764  
    232232  size_t        fileLength;
    233233  const char  * str;
    234   char          buf[TR_PATH_MAX];
    235234
    236235  tr_formatter_mem_init (MEM_K, MEM_K_STR, MEM_M_STR, MEM_G_STR, MEM_T_STR);
     
    268267  if (tr_variantDictFindStr (&settings, TR_KEY_download_dir, &str, NULL))
    269268    {
    270       str = tr_realpath (str, buf);
    271 
    272       if (str != NULL)
     269      if (!tr_fileExists (str, NULL))
     270        tr_mkdirp (str, 0700);
     271
     272      if (tr_fileExists (str, NULL))
    273273        {
    274274          tr_variantDictAddStr (&settings, TR_KEY_download_dir, str);
     
    276276      else
    277277        {
    278           fprintf (stderr, "Download directory does not exist!\n");
     278          fprintf (stderr, "Unable to create download directory \"%s\"!\n", str);
    279279          return EXIT_FAILURE;
    280280        }
Note: See TracChangeset for help on using the changeset viewer.