forked from qt-creator/qt-creator
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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user