1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-14 08:48:17 +00:00

- Fix "Append .!qB extension to incomplete files" feature

This commit is contained in:
Christophe Dumez 2009-12-18 17:18:43 +00:00
parent 88f8437c5a
commit c1bc9886b7

View File

@ -1301,15 +1301,17 @@ void Bittorrent::appendqBextensionToTorrent(QTorrentHandle h, bool append) {
for(int i=0; i<h.num_files(); ++i) { for(int i=0; i<h.num_files(); ++i) {
if(append) { if(append) {
if(fp[i] < 1.) { if(fp[i] < 1.) {
QString name = h.file_at(i); QString name = misc::toQString(h.get_torrent_info().file_at(i).path.string());
if(!name.endsWith(".!qB")) { if(!name.endsWith(".!qB")) {
qDebug("Renaming %s to %s", name.toLocal8Bit().data(), (name+".!qB").toLocal8Bit().data());
h.rename_file(i, name + ".!qB"); h.rename_file(i, name + ".!qB");
} }
} }
} else { } else {
QString name = h.file_at(i); QString name = misc::toQString(h.get_torrent_info().file_at(i).path.string());
if(name.endsWith(".!qB")) { if(name.endsWith(".!qB")) {
name.chop(4); name.chop(4);
qDebug("Renaming %s to %s", (name+".!qB").toLocal8Bit().data(), name.toLocal8Bit().data());
h.rename_file(i, name); h.rename_file(i, name);
} }
} }