From 064a5a08d2af33cfcbfb037722dec25068490db0 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 2 Apr 2012 18:08:49 +0200 Subject: add touch() function this is equivalent to unix "touch --no-create --reference ". QFile has no setLastModified() (even though QFileInfo has lastModified()), so the implementation is low-level. Change-Id: I6783e8f2613e168ad0c24e79e7384d5b2e4901ee Reviewed-by: Marius Storm-Olsen --- qmake/project.cpp | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 74 insertions(+), 1 deletion(-) (limited to 'qmake/project.cpp') diff --git a/qmake/project.cpp b/qmake/project.cpp index 643e5fda9e..1acfc2ea2a 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -54,7 +54,11 @@ #include #include #ifdef Q_OS_UNIX +#include +#include +#include #include +#include #include #elif defined(Q_OS_WIN32) #include @@ -119,7 +123,7 @@ enum TestFunc { T_REQUIRES=1, T_GREATERTHAN, T_LESSTHAN, T_EQUALS, T_EXISTS, T_EXPORT, T_CLEAR, T_UNSET, T_EVAL, T_CONFIG, T_SYSTEM, T_RETURN, T_BREAK, T_NEXT, T_DEFINED, T_CONTAINS, T_INFILE, T_COUNT, T_ISEMPTY, T_INCLUDE, T_LOAD, T_DEBUG, T_ERROR, - T_MESSAGE, T_WARNING, T_IF, T_OPTION, T_CACHE, T_WRITE_FILE }; + T_MESSAGE, T_WARNING, T_IF, T_OPTION, T_CACHE, T_WRITE_FILE, T_TOUCH }; QHash qmake_testFunctions() { static QHash *qmake_test_functions = 0; @@ -156,6 +160,7 @@ QHash qmake_testFunctions() qmake_test_functions->insert("option", T_OPTION); qmake_test_functions->insert("cache", T_CACHE); qmake_test_functions->insert("write_file", T_WRITE_FILE); + qmake_test_functions->insert("touch", T_TOUCH); } return *qmake_test_functions; } @@ -1925,6 +1930,23 @@ getCommandOutput(const QString &args) return out; } +#ifdef Q_OS_WIN +static QString windowsErrorCode() +{ + wchar_t *string = 0; + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + GetLastError(), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPWSTR)&string, + 0, + NULL); + QString ret = QString::fromWCharArray(string); + LocalFree((HLOCAL)string); + return ret; +} +#endif + QStringList QMakeProject::doProjectExpand(QString func, const QString ¶ms, QHash &place) @@ -3076,6 +3098,57 @@ QMakeProject::doProjectTest(QString func, QList args_list, QHash