Browse Source

Merge pull request #5443 from glassez/save_folder

Do not create save folder in advance. Closes #5422
adaptive-webui-19844
sledgehammer999 8 years ago committed by GitHub
parent
commit
5e114c0f2e
  1. 6
      src/base/bittorrent/session.cpp
  2. 4
      src/base/bittorrent/torrenthandle.cpp

6
src/base/bittorrent/session.cpp

@ -1368,9 +1368,6 @@ bool Session::addTorrent_impl(AddTorrentData addData, const MagnetUri &magnetUri
p.max_connections = pref->getMaxConnecsPerTorrent(); p.max_connections = pref->getMaxConnecsPerTorrent();
p.max_uploads = pref->getMaxUploadsPerTorrent(); p.max_uploads = pref->getMaxUploadsPerTorrent();
p.save_path = Utils::String::toStdString(Utils::Fs::toNativePath(savePath)); p.save_path = Utils::String::toStdString(Utils::Fs::toNativePath(savePath));
// Check if save path exists, creating it otherwise
if (!QDir(savePath).exists())
QDir().mkpath(savePath);
m_addingTorrents.insert(hash, addData); m_addingTorrents.insert(hash, addData);
// Adding torrent to BitTorrent session // Adding torrent to BitTorrent session
@ -1460,9 +1457,6 @@ bool Session::loadMetadata(const MagnetUri &magnetUri)
QString savePath = QString("%1/%2").arg(QDir::tempPath()).arg(hash); QString savePath = QString("%1/%2").arg(QDir::tempPath()).arg(hash);
p.save_path = Utils::String::toStdString(Utils::Fs::toNativePath(savePath)); p.save_path = Utils::String::toStdString(Utils::Fs::toNativePath(savePath));
// Check if save path exists, creating it otherwise
if (!QDir(savePath).exists())
QDir().mkpath(savePath);
// Forced start // Forced start
p.flags &= ~libt::add_torrent_params::flag_paused; p.flags &= ~libt::add_torrent_params::flag_paused;

4
src/base/bittorrent/torrenthandle.cpp

@ -1284,10 +1284,6 @@ void TorrentHandle::moveStorage(const QString &newPath)
if (QDir(oldPath) == QDir(newPath)) return; if (QDir(oldPath) == QDir(newPath)) return;
qDebug("move storage: %s to %s", qPrintable(oldPath), qPrintable(newPath)); qDebug("move storage: %s to %s", qPrintable(oldPath), qPrintable(newPath));
// Create destination directory if necessary
// or move_storage() will fail...
QDir().mkpath(newPath);
try { try {
// Actually move the storage // Actually move the storage
m_nativeHandle.move_storage(newPath.toUtf8().constData()); m_nativeHandle.move_storage(newPath.toUtf8().constData());

Loading…
Cancel
Save