Changeset 13837


Ignore:
Timestamp:
Jan 22, 2013, 5:58:31 AM (8 years ago)
Author:
jordan
Message:

(libT) #1220 'change file and folder names': handle .part file suffixs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r13834 r13837  
    33563356
    33573357  src = tr_buildPath (base, oldpath, NULL);
    3358   /*fprintf (stderr, "%s:%d src \"%s\"\n", __FILE__, __LINE__, src);*/
     3358  if (!tr_fileExists (src, NULL)) /* check for it as a partial */
     3359    {
     3360      char * tmp = tr_strdup_printf ("%s.part", src);
     3361      tr_free (src);
     3362      src = tmp;
     3363    }
    33593364
    33603365  if (tr_fileExists (src, NULL))
     
    33633368      bool tgt_exists;
    33643369      char * parent = tr_dirname (src);
    3365       char * tgt = tr_buildPath (parent, newname, NULL);
     3370      char * tgt;
     3371
     3372      if (tr_str_has_suffix (src, ".part"))
     3373        tgt = tr_strdup_printf ("%s" TR_PATH_DELIMITER_STR "%s.part", parent, newname);
     3374      else
     3375        tgt = tr_buildPath (parent, newname, NULL);
    33663376
    33673377      tmp = errno;
    33683378      tgt_exists = tr_fileExists (tgt, NULL);
    33693379      errno = tmp;
    3370       /*fprintf (stderr, "%s:%d tgt \"%s\"\n", __FILE__, __LINE__, tgt);*/
    33713380
    33723381      if (!tgt_exists)
     
    33763385          tmp = errno;
    33773386          rv = rename (src, tgt);
    3378           /*fprintf (stderr, "%s:%d rv \"%d\"\n", __FILE__, __LINE__, rv);*/
    33793387          if (rv != 0)
    33803388            error = errno;
Note: See TracChangeset for help on using the changeset viewer.