forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/8.0'
Conflicts: share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/icons.ttf src/libs/utils/fileutils.cpp src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp src/plugins/qmldesigner/designercore/include/abstractview.h src/plugins/qmldesigner/designercore/include/nodemetainfo.h src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp src/plugins/qmldesigner/designercore/model/model_p.h src/plugins/remotelinux/linuxdevice.cpp tests/auto/utils/fileutils/tst_fileutils.cpp Change-Id: I26a21e2523d3d725fdb8c548a531cdbdaeaeca20
This commit is contained in:
@@ -1269,13 +1269,9 @@ qint64 LinuxDevice::bytesAvailable(const FilePath &filePath) const
|
||||
QTC_ASSERT(handlesFile(filePath), return -1);
|
||||
CommandLine cmd("df", {"-k"});
|
||||
cmd.addArg(filePath.path());
|
||||
cmd.addArgs("|tail -n 1 |sed 's/ */ /g'|cut -d ' ' -f 4", CommandLine::Raw);
|
||||
const QByteArray output = d->outputForRunInShell(cmd).value_or(QByteArray());
|
||||
bool ok = false;
|
||||
const qint64 size = output.toLongLong(&ok);
|
||||
if (ok)
|
||||
return size * 1024;
|
||||
return -1;
|
||||
|
||||
return FileUtils::bytesAvailableFromDFOutput(output);
|
||||
}
|
||||
|
||||
QFileDevice::Permissions LinuxDevice::permissions(const FilePath &filePath) const
|
||||
@@ -1499,18 +1495,12 @@ private:
|
||||
return;
|
||||
}
|
||||
|
||||
m_batchFile.reset(new QTemporaryFile(this));
|
||||
if (!m_batchFile->isOpen() && !m_batchFile->open()) {
|
||||
startFailed(Tr::tr("Could not create temporary file: %1")
|
||||
.arg(m_batchFile->errorString()));
|
||||
return;
|
||||
}
|
||||
QByteArray batchData;
|
||||
|
||||
const FilePaths dirs = dirsToCreate(m_setup.m_files);
|
||||
for (const FilePath &dir : dirs) {
|
||||
if (direction() == FileTransferDirection::Upload) {
|
||||
m_batchFile->write("-mkdir " + ProcessArgs::quoteArgUnix(dir.path()).toLocal8Bit()
|
||||
+ '\n');
|
||||
batchData += "-mkdir " + ProcessArgs::quoteArgUnix(dir.path()).toLocal8Bit() + '\n';
|
||||
} else if (direction() == FileTransferDirection::Download) {
|
||||
if (!QDir::root().mkpath(dir.path())) {
|
||||
startFailed(Tr::tr("Failed to create local directory \"%1\".")
|
||||
@@ -1527,26 +1517,23 @@ private:
|
||||
const QFileInfo fi(file.m_source.toFileInfo());
|
||||
if (fi.isSymLink()) {
|
||||
link = true;
|
||||
m_batchFile->write("-rm " + ProcessArgs::quoteArgUnix(
|
||||
file.m_target.path()).toLocal8Bit() + '\n');
|
||||
batchData += "-rm " + ProcessArgs::quoteArgUnix(
|
||||
file.m_target.path()).toLocal8Bit() + '\n';
|
||||
// see QTBUG-5817.
|
||||
sourceFileOrLinkTarget =
|
||||
sourceFileOrLinkTarget.withNewPath(fi.dir().relativeFilePath(fi.symLinkTarget()));
|
||||
}
|
||||
}
|
||||
m_batchFile->write(transferCommand(direction(), link) + ' '
|
||||
+ ProcessArgs::quoteArgUnix(sourceFileOrLinkTarget.path()).toLocal8Bit() + ' '
|
||||
+ ProcessArgs::quoteArgUnix(file.m_target.path()).toLocal8Bit() + '\n');
|
||||
batchData += transferCommand(direction(), link) + ' '
|
||||
+ ProcessArgs::quoteArgUnix(sourceFileOrLinkTarget.path()).toLocal8Bit() + ' '
|
||||
+ ProcessArgs::quoteArgUnix(file.m_target.path()).toLocal8Bit() + '\n';
|
||||
}
|
||||
m_batchFile->close();
|
||||
process().setCommand(CommandLine(sftpBinary, fullConnectionOptions()
|
||||
<< "-b" << m_batchFile->fileName() << host()));
|
||||
process().setCommand({sftpBinary, fullConnectionOptions() << "-b" << "-" << host()});
|
||||
process().setWriteData(batchData);
|
||||
process().start();
|
||||
}
|
||||
|
||||
void doneImpl() final { handleDone(); }
|
||||
|
||||
std::unique_ptr<QTemporaryFile> m_batchFile;
|
||||
};
|
||||
|
||||
class RsyncTransferImpl : public SshTransferInterface
|
||||
|
||||
Reference in New Issue
Block a user