resources_function.prf: Discard external path prefixes

qtdeclarative's QtQml module adds a dynamically generated qmldir file to
its RESOURCES which is located outside the source directory.
Previously this caused qmake to generate an invalid alias for the qmldir file.
Now the relative path is discarded properly.

Fixes: QTBUG-88204
Change-Id: Ia689d9d110db092cee595bf44fcbb6d57783fded
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Maximilian Goldstein 2020-11-10 12:54:37 +01:00
parent ba0895cf69
commit 0bfb39da85

View File

@ -67,6 +67,12 @@ defineTest(qtFlattenResources) {
for (file, files) {
exists($$file/*): next() # exclude directories
alias = $$relative_path($$file, $$abs_base)
# If a resource is added by the build system from outside of $$_PRO_FILE_PWD_
# everything except the filename needs to be discarded.
subdir = $$find(alias, ^../)
if (!isEmpty(subdir)): alias = $$basename(file)
resource_file_content += \
"<file alias=\"$$xml_escape($$alias)\">$$xml_escape($$file)</file>"
OTHER_FILES *= $$file