diff options
author | hjk <[email protected]> | 2021-06-14 08:33:44 +0200 |
---|---|---|
committer | hjk <[email protected]> | 2021-06-14 11:19:31 +0000 |
commit | a5b16f8137a8b14e849d08a7f90d323301773942 (patch) | |
tree | 813e02b87560d1da85935c33b0a9cb0694693623 /src/libs/utils/fileutils.cpp | |
parent | 4a04e75a4df86a57bba5d051a812b8f11245f805 (diff) |
Utils: Support remote FilePath::{lastModified,{remove,copy}File}
And implement the Docker variant.
Change-Id: Iee7cd0aaaf3d5c7dbb4ff995ac6889f31cb2f505
Reviewed-by: David Schulz <[email protected]>
Diffstat (limited to 'src/libs/utils/fileutils.cpp')
-rw-r--r-- | src/libs/utils/fileutils.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/libs/utils/fileutils.cpp b/src/libs/utils/fileutils.cpp index a5965590a7d..92c3ac819f7 100644 --- a/src/libs/utils/fileutils.cpp +++ b/src/libs/utils/fileutils.cpp @@ -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(); |