common/FileUtil.cpp | 27 ++++++++++++++++++++++++--- common/FileUtil.hpp | 9 ++++++++- 2 files changed, 32 insertions(+), 4 deletions(-)
New commits: commit 30aa038235c30e435e558d83ca2a4cc70848db92 Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Wed Jul 8 14:27:19 2020 +0300 Commit: Tor Lillqvist <t...@collabora.com> CommitDate: Wed Jul 8 15:20:14 2020 +0200 Make FileUtil.{hpp,cpp} compile for iOS again Change-Id: I0446c17401c32a76cc5acee168501b7b9fc515e4 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98368 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Tested-by: Jenkins Reviewed-by: Tor Lillqvist <t...@collabora.com> diff --git a/common/FileUtil.cpp b/common/FileUtil.cpp index 1f31e536d..6a61b926e 100644 --- a/common/FileUtil.cpp +++ b/common/FileUtil.cpp @@ -282,8 +282,23 @@ namespace FileUtil bool updateTimestamps(const std::string& filename, timespec tsAccess, timespec tsModified) { // The timestamp is in seconds and microseconds. - timeval timestamps[2]{ { tsAccess.tv_sec, tsAccess.tv_nsec / 1000 }, - { tsModified.tv_sec, tsModified.tv_nsec / 1000 } }; + timeval timestamps[2] + { + { + tsAccess.tv_sec, +#ifdef IOS + (__darwin_suseconds_t) +#endif + (tsAccess.tv_nsec / 1000) + }, + { + tsModified.tv_sec, +#ifdef IOS + (__darwin_suseconds_t) +#endif + (tsModified.tv_nsec / 1000) + } + }; if (utimes(filename.c_str(), timestamps) != 0) { LOG_SYS("Failed to update the timestamp of [" << filename << "]"); @@ -301,7 +316,13 @@ namespace FileUtil if (preserveTimestamps) { const Stat st(fromPath); - updateTimestamps(randFilename, st.sb().st_atim, st.sb().st_mtim); + updateTimestamps(randFilename, +#ifdef IOS + st.sb().st_atimespec, st.sb().st_mtimespec +#else + st.sb().st_atim, st.sb().st_mtim +#endif + ); } // Now rename atomically, replacing any existing files with the same name. diff --git a/common/FileUtil.hpp b/common/FileUtil.hpp index 7d484d3d5..dc87d205a 100644 --- a/common/FileUtil.hpp +++ b/common/FileUtil.hpp @@ -140,7 +140,14 @@ namespace FileUtil size_t size() const { return _sb.st_size; } /// Returns the modified time. - timespec modifiedTime() const { return _sb.st_mtim; } + timespec modifiedTime() const + { +#ifdef IOS + return _sb.st_mtimespec; +#else + return _sb.st_mtim; +#endif + } /// Returns true iff the path exists, regardless of access permission. bool exists() const { return good() || (_errno != ENOENT && _errno != ENOTDIR); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits