mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-16 21:11:50 +03:00
Optimize the addittion of huge torrents. Fixes issue #288.
This commit is contained in:
parent
1a5056763c
commit
c8753c96db
1 changed files with 2 additions and 11 deletions
|
@ -1270,20 +1270,11 @@ void QBtSession::loadTorrentTempData(QTorrentHandle &h, QString savePath, bool m
|
|||
// Update file names
|
||||
const QStringList files_path = TorrentTempData::getFilesPath(hash);
|
||||
bool force_recheck = false;
|
||||
QDir base_dir(h.save_path());
|
||||
if (files_path.size() == h.num_files()) {
|
||||
for (int i=0; i<h.num_files(); ++i) {
|
||||
QString old_path = h.absolute_files_path().at(i);
|
||||
old_path.replace("\\", "/");
|
||||
if (!QFile::exists(old_path)) {
|
||||
// Remove old parent folder manually since we will
|
||||
// not get a file_renamed alert
|
||||
QStringList parts = old_path.split("/", QString::SkipEmptyParts);
|
||||
parts.removeLast();
|
||||
if (!parts.empty())
|
||||
QDir().rmpath(parts.join("/"));
|
||||
}
|
||||
const QString &path = files_path.at(i);
|
||||
if (!force_recheck && QDir(h.save_path()).exists(path))
|
||||
if (!force_recheck && base_dir.exists(path))
|
||||
force_recheck = true;
|
||||
qDebug("Renaming file to %s", qPrintable(path));
|
||||
h.rename_file(i, path);
|
||||
|
|
Loading…
Reference in a new issue