Utils: Support remote FilePath::{lastModified,{remove,copy}File}

And implement the Docker variant.

Change-Id: Iee7cd0aaaf3d5c7dbb4ff995ac6889f31cb2f505
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
hjk
2021-06-14 08:33:44 +02:00
parent 4a04e75a4d
commit a5b16f8137
7 changed files with 124 additions and 4 deletions

View File

@@ -1346,10 +1346,31 @@ uint FilePath::hash(uint seed) const
QDateTime FilePath::lastModified() const
{
QTC_CHECK(!needsDevice());
if (needsDevice()) {
QTC_ASSERT(s_deviceHooks.lastModified, return {});
return s_deviceHooks.lastModified(*this);
}
return toFileInfo().lastModified();
}
bool FilePath::removeFile() const
{
if (needsDevice()) {
QTC_ASSERT(s_deviceHooks.removeFile, return false);
return s_deviceHooks.removeFile(*this);
}
return QFile::remove(path());
}
bool FilePath::copyFile(const FilePath &target) const
{
if (needsDevice()) {
QTC_ASSERT(s_deviceHooks.copyFile, return false);
return s_deviceHooks.copyFile(*this, target);
}
return QFile::copy(path(), target.path());
}
QTextStream &operator<<(QTextStream &s, const FilePath &fn)
{
return s << fn.toString();