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>
This commit is contained in:
Simon Hausmann
2017-03-01 12:41:48 +01:00
committed by Oswald Buddenhagen
parent fe70177c17
commit 274726efb0
2 changed files with 39 additions and 0 deletions

View File

@@ -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

View File

@@ -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
};