diff --git a/src/plugins/remotelinux/deployablefile.h b/src/plugins/remotelinux/deployablefile.h index b3b202254ba563152f1cc2caf8d60e5ab64b1b7a..fcd2a835b2fbce488310f1e422c31d7d2eb2929a 100644 --- a/src/plugins/remotelinux/deployablefile.h +++ b/src/plugins/remotelinux/deployablefile.h @@ -35,6 +35,7 @@ #include "remotelinux_export.h" +#include <QtCore/QFileInfo> #include <QtCore/QHash> #include <QtCore/QString> @@ -54,6 +55,10 @@ public: && remoteDir == other.remoteDir; } + QString remoteFilePath() const { + return remoteDir + QLatin1Char('/') + QFileInfo(localFilePath).fileName(); + } + QString localFilePath; QString remoteDir; }; diff --git a/src/plugins/remotelinux/genericdirectuploadservice.cpp b/src/plugins/remotelinux/genericdirectuploadservice.cpp index 16f5e7dcd20ee903baf078cd2c7e6363833ee25b..85925e3d89383ff7da92ce8f6e81835f3228590e 100644 --- a/src/plugins/remotelinux/genericdirectuploadservice.cpp +++ b/src/plugins/remotelinux/genericdirectuploadservice.cpp @@ -159,8 +159,13 @@ void GenericDirectUploadService::handleUploadFinished(Utils::SftpJobId jobId, co const DeployableFile df = d->filesToUpload.takeFirst(); if (!errorMsg.isEmpty()) { - emit errorMessage(tr("Upload of file '%1' failed: %2") - .arg(QDir::toNativeSeparators(df.localFilePath), errorMsg)); + QString errorString = tr("Upload of file '%1' failed. The server said: '%2'.") + .arg(QDir::toNativeSeparators(df.localFilePath), errorMsg); + if (errorMsg == QLatin1String("Failure") && df.remoteDir.contains(QLatin1String("/bin"))) { + errorString += QLatin1Char(' ') + tr("If '%1' is currently running " + "on the remote host, you might need to stop it first.").arg(df.remoteFilePath()); + } + emit errorMessage(errorString); setFinished(); handleDeploymentDone(); } else { @@ -168,9 +173,7 @@ void GenericDirectUploadService::handleUploadFinished(Utils::SftpJobId jobId, co // Terrible hack for Windows. if (df.remoteDir.contains(QLatin1String("bin"))) { - const QString remoteFilePath = df.remoteDir + QLatin1Char('/') - + QFileInfo(df.localFilePath).fileName(); - const QString command = QLatin1String("chmod a+x ") + remoteFilePath; + const QString command = QLatin1String("chmod a+x ") + df.remoteFilePath(); connection()->createRemoteProcess(command.toUtf8())->start(); }