forked from qt-creator/qt-creator
Utils: Add an offset parameter to the content writing FilePath function
Use QFile::seek to implement locally and a dd seek based poor man's implementation on RL and docker. Change-Id: I241d1c34c00e991845d132ad8edefa1377ba1311 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -910,10 +910,17 @@ std::optional<QByteArray> DockerDevice::fileContents(const FilePath &filePath,
|
||||
return d->fileContents(filePath, limit, offset);
|
||||
}
|
||||
|
||||
bool DockerDevice::writeFileContents(const FilePath &filePath, const QByteArray &data) const
|
||||
bool DockerDevice::writeFileContents(const FilePath &filePath,
|
||||
const QByteArray &data,
|
||||
qint64 offset) const
|
||||
{
|
||||
QTC_ASSERT(handlesFile(filePath), return {});
|
||||
return d->runInShellSuccess({"dd", {"of=" + filePath.path()}}, data);
|
||||
CommandLine cmd({"dd", {"of=" + filePath.path()}});
|
||||
if (offset != 0) {
|
||||
cmd.addArg("bs=1");
|
||||
cmd.addArg(QString("seek=%1").arg(offset));
|
||||
}
|
||||
return d->runInShellSuccess(cmd, data);
|
||||
}
|
||||
|
||||
Environment DockerDevice::systemEnvironment() const
|
||||
|
||||
Reference in New Issue
Block a user