Changeset 13632
- Timestamp:
- Dec 9, 2012, 1:27:01 AM (10 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/metainfo.c
r13631 r13632 86 86 and we don't want to return NULL anyway */ 87 87 return tr_strdup_printf ("%s%c%s-%s", tr_getTorrentDir (session), '/', inf->hashString, "gtk"); 88 }89 90 /* this is for really old versions of T and will probably be removed someday */91 void92 tr_metainfoMigrate (tr_session * session, tr_info * inf)93 {94 struct stat new_sb;95 char * name = getTorrentFilename (session, inf);96 97 if (stat (name, &new_sb) || ((new_sb.st_mode & S_IFMT) != S_IFREG))98 {99 char * old_name = getOldTorrentFilename (session, inf);100 size_t contentLen;101 uint8_t * content;102 103 tr_mkdirp (tr_getTorrentDir (session), 0777);104 if ((content = tr_loadFile (old_name, &contentLen)))105 {106 FILE * out;107 errno = 0;108 out = fopen (name, "wb+");109 if (!out)110 {111 tr_nerr (inf->name, _("Couldn't create \"%1$s\": %2$s"), name, tr_strerror (errno));112 }113 else114 {115 if (fwrite (content, sizeof (uint8_t), contentLen, out) == contentLen)116 {117 tr_free (inf->torrent);118 inf->torrent = tr_strdup (name);119 tr_sessionSetTorrentFile (session, inf->hashString, name);120 unlink (old_name);121 }122 fclose (out);123 }124 }125 126 tr_free (content);127 tr_free (old_name);128 }129 130 tr_free (name);131 88 } 132 89 -
trunk/libtransmission/metainfo.h
r13625 r13632 31 31 const tr_info * info); 32 32 33 void tr_metainfoMigrate (tr_session * session,34 tr_info * inf);35 36 33 char* tr_metainfoGetBasename (const tr_info *); 37 34
Note: See TracChangeset
for help on using the changeset viewer.