RemoteLinux: Simplify GenericDirectUploadService::collectFilesToUpload()

Change-Id: I50407575501f108ec442a0ccbdbd321aaa1281c5
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2021-08-18 16:59:47 +02:00
parent d8a61bcea4
commit b9f4a0e7e4

View File

@@ -43,6 +43,7 @@
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace QSsh; using namespace QSsh;
using namespace Utils;
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { namespace Internal {
@@ -232,17 +233,12 @@ QList<DeployableFile> GenericDirectUploadService::collectFilesToUpload(
const DeployableFile &deployable) const const DeployableFile &deployable) const
{ {
QList<DeployableFile> collected; QList<DeployableFile> collected;
QFileInfo fileInfo = deployable.localFilePath().toFileInfo(); FilePath localFile = deployable.localFilePath();
if (fileInfo.isDir()) { if (localFile.isDir()) {
const QStringList files = QDir(deployable.localFilePath().toString()) const FilePaths files = localFile.dirEntries(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot); const QString remoteDir = deployable.remoteDirectory() + '/' + localFile.fileName();
for (const QString &fileName : files) { for (const FilePath &localFilePath : files)
const QString localFilePath = deployable.localFilePath().toString()
+ QLatin1Char('/') + fileName;
const QString remoteDir = deployable.remoteDirectory() + QLatin1Char('/')
+ fileInfo.fileName();
collected.append(collectFilesToUpload(DeployableFile(localFilePath, remoteDir))); collected.append(collectFilesToUpload(DeployableFile(localFilePath, remoteDir)));
}
} else { } else {
collected << deployable; collected << deployable;
} }