diff --git a/src/qtlibtorrent/qbtsession.cpp b/src/qtlibtorrent/qbtsession.cpp index 04d18e987..e6dba5ba8 100755 --- a/src/qtlibtorrent/qbtsession.cpp +++ b/src/qtlibtorrent/qbtsession.cpp @@ -80,7 +80,7 @@ //initialize static member variables QHash TorrentTempData::data = QHash(); -QHash TorrentTempData::torrentMoveStates = QHash(); +QHash TorrentTempData::torrentMoveStates = QHash(); QHash HiddenData::data = QHash(); unsigned int HiddenData::metadata_counter = 0; @@ -2418,12 +2418,12 @@ void QBtSession::handleStorageMovedAlert(libtorrent::storage_moved_alert* p) { } QString new_save_path = fsutils::fromNativePath(misc::toQStringU(p->path.c_str())); - if (new_save_path != TorrentTempData::getNewPath(hash)) { + if (new_save_path != fsutils::fromNativePath(TorrentTempData::getNewPath(hash))) { qWarning("new path received in handleStorageMovedAlert() doesn't match a path in a queue"); return; } - QString oldPath = TorrentTempData::getOldPath(hash); + QString oldPath = fsutils::fromNativePath(TorrentTempData::getOldPath(hash)); qDebug("Torrent is successfully moved from %s to %s", qPrintable(oldPath), qPrintable(new_save_path)); @@ -2441,7 +2441,7 @@ void QBtSession::handleStorageMovedAlert(libtorrent::storage_moved_alert* p) { //h.force_recheck(); QString queued = TorrentTempData::getQueuedPath(hash); - if (queued != QString()) { + if (!queued.isEmpty()) { TorrentTempData::finishMove(hash); h.move_storage(queued); } @@ -2465,9 +2465,12 @@ void QBtSession::handleStorageMovedFailedAlert(libtorrent::storage_moved_failed_ return; } + addConsoleMessage(tr("Could not move torrent: '%1'. Reason: %2").arg(h.name()).arg(misc::toQStringU(p->message())), "red"); + QString queued = TorrentTempData::getQueuedPath(hash); - if (queued != QString()) { + if (!queued.isEmpty()) { TorrentTempData::finishMove(hash); + addConsoleMessage(tr("Attempting to move torrent: '%1' to path: '%2'.").arg(h.name()).arg(fsutils::toNativePath(queued))); h.move_storage(queued); } else { diff --git a/src/torrentpersistentdata.h b/src/torrentpersistentdata.h index 71726f1ed..32c865cf0 100644 --- a/src/torrentpersistentdata.h +++ b/src/torrentpersistentdata.h @@ -42,20 +42,6 @@ #include "qinisettings.h" #include -struct TorrentMoveState -{ - TorrentMoveState(QString oldPath, QString newPath) - : oldPath(oldPath) - , newPath(newPath) - {} - - // the moving occurs from oldPath to newPath - // queuedPath is where files should be moved to, when current moving is completed - QString oldPath; - QString newPath; - QString queuedPath; -}; - class TorrentTempData { // This class stores strings w/o modifying separators public: @@ -185,6 +171,20 @@ private: bool seed; }; + struct TorrentMoveState + { + TorrentMoveState(QString oldPath, QString newPath) + : oldPath(oldPath) + , newPath(newPath) + {} + + // the moving occurs from oldPath to newPath + // queuedPath is where files should be moved to, when current moving is completed + QString oldPath; + QString newPath; + QString queuedPath; + }; + static QHash data; static QHash torrentMoveStates; };