diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2017-03-01 12:41:48 +0100 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2018-03-14 15:33:41 +0000 |
commit | 274726efb0bbc5055f02b1b76f2481564ad27f46 (patch) | |
tree | c7e25c4fac53d29a511cb9f9f320f93667784c14 /src | |
parent | fe70177c177abb23c286b8cf483772900e8d9fe2 (diff) |
qmake: Preserve last modification timestamps of installed directories
sync-up with qmake; no effect on creator.
Change-Id: Id5931a467196d5cd67acfa0deffc2488af8a3669
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
(cherry picked from qtbase/c12b96daf2195c475c086f8f9be833aa0e28b26c)
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/shared/proparser/ioutils.cpp | 36 | ||||
-rw-r--r-- | src/shared/proparser/ioutils.h | 3 |
2 files changed, 39 insertions, 0 deletions
diff --git a/src/shared/proparser/ioutils.cpp b/src/shared/proparser/ioutils.cpp index c0bbbe768a..552df764c3 100644 --- a/src/shared/proparser/ioutils.cpp +++ b/src/shared/proparser/ioutils.cpp @@ -249,6 +249,42 @@ bool IoUtils::touchFile(const QString &targetFileName, const QString &referenceF # endif return true; } + +#if defined(QT_BUILD_QMAKE) && defined(Q_OS_UNIX) +bool IoUtils::readLinkTarget(const QString &symlinkPath, QString *target) +{ + const QByteArray localSymlinkPath = QFile::encodeName(symlinkPath); +# if defined(__GLIBC__) && !defined(PATH_MAX) +# define PATH_CHUNK_SIZE 256 + char *s = 0; + int len = -1; + int size = PATH_CHUNK_SIZE; + + forever { + s = (char *)::realloc(s, size); + len = ::readlink(localSymlinkPath.constData(), s, size); + if (len < 0) { + ::free(s); + break; + } + if (len < size) + break; + size *= 2; + } +# else + char s[PATH_MAX+1]; + int len = readlink(localSymlinkPath.constData(), s, PATH_MAX); +# endif + if (len <= 0) + return false; + *target = QFile::decodeName(QByteArray(s, len)); +# if defined(__GLIBC__) && !defined(PATH_MAX) + ::free(s); +# endif + return true; +} #endif +#endif // PROEVALUATOR_FULL + QT_END_NAMESPACE diff --git a/src/shared/proparser/ioutils.h b/src/shared/proparser/ioutils.h index 150c837369..71a7ffed56 100644 --- a/src/shared/proparser/ioutils.h +++ b/src/shared/proparser/ioutils.h @@ -62,6 +62,9 @@ public: #endif #if defined(PROEVALUATOR_FULL) static bool touchFile(const QString &targetFileName, const QString &referenceFileName, QString *errorString); +# if defined(QT_BUILD_QMAKE) && defined(Q_OS_UNIX) + static bool readLinkTarget(const QString &symlinkPath, QString *target); +# endif #endif }; |