Skip to content

SFTP upload directory make append dir path optional #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/libs/qssh/sftpchannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ SftpJobId SftpChannel::downloadFile(const QString &remoteFilePath, QSharedPointe
}

SftpJobId SftpChannel::uploadDir(const QString &localDirPath,
const QString &remoteParentDirPath)
const QString &remoteParentDirPath, bool appendDirPath)
{
if (state() != Initialized)
return SftpInvalidJob;
Expand All @@ -248,8 +248,10 @@ SftpJobId SftpChannel::uploadDir(const QString &localDirPath,
return SftpInvalidJob;
const Internal::SftpUploadDir::Ptr uploadDirOp(
new Internal::SftpUploadDir(++d->m_nextJobId));
const QString remoteDirPath
= remoteParentDirPath + u'/' + localDir.dirName();
QString remoteDirPath = remoteParentDirPath;
if (appendDirPath) {
remoteDirPath += u'/' + localDir.dirName();
}
const Internal::SftpMakeDir::Ptr mkdirOp(
new Internal::SftpMakeDir(++d->m_nextJobId, remoteDirPath, uploadDirOp));
uploadDirOp->mkdirsInProgress.insert(mkdirOp,
Expand Down
4 changes: 2 additions & 2 deletions src/libs/qssh/sftpchannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,11 @@ class QSSH_EXPORT SftpChannel : public QObject
/*!
* \brief Uploads a local directory (recursively) with files to the remote host
* \param localDirPath The path to an existing local directory
* \param remoteParentDirPath The remote path to upload it to, the name of the local directory will be appended to this
* \param remoteParentDirPath The remote path to upload it to, the name of the local directory will be appended to this if appendDirPath is set
* \return A unique ID identifying this job
*/
SftpJobId uploadDir(const QString &localDirPath,
const QString &remoteParentDirPath);
const QString &remoteParentDirPath, bool appendDirPath = true);

/*!
* \brief Downloads a remote directory (recursively) to a local path
Expand Down