From fa096b9cc44c4e3f1c54337ae68bcc10ce153353 Mon Sep 17 00:00:00 2001 From: kai Date: Fri, 11 Sep 2026 11:57:03 +1200 Subject: [PATCH] gui: stop pre-creating the download destination folder tree RetroshareDirModel::downloadDirectory(), RsCollection::autoDownloadFiles() and RsCollectionDialog::download() each mkpath() the full destination directory tree the moment a directory/collection download is requested, long before any file content arrives. RsDirUtil::moveFile() already creates missing destination directories lazily when each file completes, so this up-front creation only leaves empty folders sitting in the download location for the whole duration of the transfer. Drop the redundant mkpath() calls; the folder tree now materialises as files actually finish. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_0137V8RpdwiKisg9SSrMEiBt --- retroshare-gui/src/gui/RemoteDirModel.cpp | 8 ++++---- retroshare-gui/src/gui/common/RsCollection.cpp | 6 +++--- retroshare-gui/src/gui/common/RsCollectionDialog.cpp | 7 +++---- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/retroshare-gui/src/gui/RemoteDirModel.cpp b/retroshare-gui/src/gui/RemoteDirModel.cpp index d14a843e5..ed82b92f9 100644 --- a/retroshare-gui/src/gui/RemoteDirModel.cpp +++ b/retroshare-gui/src/gui/RemoteDirModel.cpp @@ -1365,11 +1365,11 @@ void RetroshareDirModel::downloadDirectory(const DirDetails & dirDetails, int pr } else if (dirDetails.type & DIR_TYPE_DIR) { + // No need to pre-create the destination folder here: each file's + // FileRequest() stages into the Partials directory, and + // RsDirUtil::moveFile() creates any missing destination directories + // lazily once that file actually completes. std::list::const_iterator it; - QDir dwlDir(QString::fromUtf8(rsFiles->getDownloadDirectory().c_str())); - QString cleanPath = QDir::cleanPath(QString::fromUtf8(dirDetails.path.substr(prefixLen).c_str())); - - if (!dwlDir.mkpath(cleanPath)) return; for(uint32_t i=0;iFileRequest(colFileInfo.name.toUtf8().constData(), diff --git a/retroshare-gui/src/gui/common/RsCollectionDialog.cpp b/retroshare-gui/src/gui/common/RsCollectionDialog.cpp index 8352597b4..d626fbe0d 100644 --- a/retroshare-gui/src/gui/common/RsCollectionDialog.cpp +++ b/retroshare-gui/src/gui/common/RsCollectionDialog.cpp @@ -739,10 +739,9 @@ void RsCollectionDialog::download() const auto& sdd = mCollection->fileTree().directoryData(e.index); std::string subpath = RsDirUtil::makePath(path,sdd.name); - std::cerr << "Creating subdir " << sdd.name << " to directory " << path << std::endl; - - if(!QDir(QApplication::applicationDirPath()).mkpath(QString::fromUtf8(subpath.c_str()))) - QMessageBox::warning(NULL,tr("Unable to make path"),tr("Unable to make path:")+"
"+QString::fromUtf8(subpath.c_str())) ; + // No need to pre-create subpath here: FileRequest() stages into + // the Partials directory, and RsDirUtil::moveFile() creates any + // missing destination directories lazily once a file completes. recursDL(dirdata.subdirs[i],subpath); }