Utils: Replace FilePath part setters

... by a combined version. This will make it easier to store the parts
in one QString object.

Change-Id: Ie85a77e3957c78a30e49998fe2e617af35a8ad17
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
hjk
2022-08-04 15:00:24 +02:00
parent 7a3f95a144
commit 7cfc3d26bc
18 changed files with 60 additions and 119 deletions

View File

@@ -730,8 +730,7 @@ CommandLine SshProcessInterfacePrivate::fullLocalCommandLine() const
cmd.addArgs(options);
CommandLine remoteWithLocalPath = q->m_setup.m_commandLine;
FilePath executable;
executable.setPath(remoteWithLocalPath.executable().path());
FilePath executable = FilePath::fromParts({}, {}, remoteWithLocalPath.executable().path());
remoteWithLocalPath.setExecutable(executable);
cmd.addArg(q->fullCommandLine(remoteWithLocalPath));
@@ -1028,11 +1027,7 @@ QString LinuxDevice::userAtHost() const
FilePath LinuxDevice::rootPath() const
{
FilePath root;
root.setScheme(u"ssh");
root.setHost(userAtHost());
root.setPath(u"/");
return root;
return FilePath::fromParts(u"ssh", userAtHost(), u"/");
}
bool LinuxDevice::handlesFile(const FilePath &filePath) const
@@ -1515,7 +1510,8 @@ private:
m_batchFile->write("-rm " + ProcessArgs::quoteArgUnix(
file.m_target.path()).toLocal8Bit() + '\n');
// see QTBUG-5817.
sourceFileOrLinkTarget.setPath(fi.dir().relativeFilePath(fi.symLinkTarget()));
sourceFileOrLinkTarget =
sourceFileOrLinkTarget.withNewPath(fi.dir().relativeFilePath(fi.symLinkTarget()));
}
}
m_batchFile->write(transferCommand(direction(), link) + ' '
@@ -1597,8 +1593,10 @@ private:
}
FileToTransfer fixedFile = file;
(direction() == FileTransferDirection::Upload) ? fixedFile.m_source.setPath(localFilePath)
: fixedFile.m_target.setPath(localFilePath);
if (direction() == FileTransferDirection::Upload)
fixedFile.m_source = fixedFile.m_source.withNewPath(localFilePath);
else
fixedFile.m_target = fixedFile.m_target.withNewPath(localFilePath);
return fixedFile;
}