diff options
author | Andy Shaw <andy.shaw@qt.io> | 2017-06-13 15:10:30 +0200 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2017-06-19 08:39:40 +0000 |
commit | b2cb83ecbb1eec29268852d1b230f37e4c8592e9 (patch) | |
tree | 0b481751c2a3960af8dbe3f5488f6c7da4dc9481 /qmake | |
parent | a2322519929bd36a90422dccc0310b8230729197 (diff) |
Pass the absolute path with the file when finding files
When generating a project, the directories can be specified as arguments
to the qmake call. As a result files can either be incorrectly added to
the project with a leading slash, or can end up duplicated. By passing
the absolute path with the file, it ensures that the file is added
correctly and no duplicates occur as a result.
Task-number: QTBUG-48342
Change-Id: If774de8d7f5cceca80042a25a3aa4e5b045249da
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/generators/projectgenerator.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/qmake/generators/projectgenerator.cpp b/qmake/generators/projectgenerator.cpp index eb4f46cd7e..073d315aab 100644 --- a/qmake/generators/projectgenerator.cpp +++ b/qmake/generators/projectgenerator.cpp @@ -118,14 +118,15 @@ ProjectGenerator::init() dir = regex.left(s+1); regex = regex.right(regex.length() - (s+1)); } + const QDir d(dir); if (Option::recursive) { - QStringList entries = QDir(dir).entryList(QDir::Dirs | QDir::NoDotAndDotDot); + QStringList entries = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot); for (int i = 0; i < entries.count(); i++) dirs.append(dir + entries[i] + QDir::separator() + regex); } - QStringList files = QDir(dir).entryList(QDir::nameFiltersFromString(regex)); + QStringList files = d.entryList(QDir::nameFiltersFromString(regex)); for(int i = 0; i < (int)files.count(); i++) { - QString file = dir + files[i]; + QString file = d.absoluteFilePath(files[i]); if (addFile(file)) { add_depend = true; file_count++; |