[Interest] Can't include Android asset filenames containing spaces in qmake 5.15
Rob Allan
rob_allan at trimble.com
Tue Dec 1 03:32:23 CET 2020
Something seems to have changed between Qt 5.13 and 5.15 in terms of how
qmake handles Android asset filenames containing spaces. With 5.13, we were
able to do the following in our .pro file:
ASSET_DATA.path = /assets
ASSET_DATA.files += $$quote(.\MyFiles\FileWithoutSpaces.txt)
ASSET_DATA.files += $$quote(.\MyFiles\File With Spaces.txt)
INSTALLS += ASSET_DATA
The $$quote is unnecessary, but harmless, with the first of these files.
It's essential with the second file that includes spaces in the filename.
With Qt 5.15, this no longer works. Qmake fails with an error, and stops
processing the file. The error is:
1>C:\Qt\5.15.1\android\bin\qmake.exe -install qinstall
C:\Build\MyFiles\File\ With\ Spaces.txt
android-build\armeabi-v7a\Release\assets\File\ With\ Spaces.txt
1>EXEC : error : usage: [-exe] source target
1>make.exe: *** [Makefile:24733: install_ASSET_DATA] Error 3
I've tried using $$shell_quote and $$system_quote in place of $$quote, both
of which seems to be "stronger" quoting methods. (If you use 'message' to
output the contents of ASSET_DATA.files, then you don't see the quotes in
the message when you use $$quote, but they are still present in the message
output when you use $$shell_quote or $$system_quote.) If I use
$$shell_quote or $$system_quote, then qmake continues and doesn't report
an error, but any files containing spaces are simply skipped and ignored,
and don't end up in the assets.
I've also tried actual double-quotes, double-quotes escaped with
backslashes, escaping the space characters with backslashes, and pretty
much anything else I could think of - no dice.
Does anyone know what's changed here, and how I can go about including
asset files with embedded spaces in their names?
(I'm aware that one answer to this query is "Don't have spaces in your
filenames". I'm looking into that option, but for historical reasons we
have a lot of files containing embedded spaces, so getting rid of them all
will have a lot of impacts and will require quite a bit of work. So I'd
like to avoid that solution if I can.)
Thanks,
Rob Allan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20201201/0ee3cc20/attachment.html>
More information about the Interest
mailing list