[solved] using wildcard characters with .path/.files and QMAKE_BUNDLE_DATA



  • I've been at this now for a day and its been a frustrating learning experience. After many hours of testing, I got this loading content into the bundle on ios (this is in my .pro file):

    @packets.files = ../Ankh/assets/packets/cube.gly
    ../Ankh/assets/packets/libtest.gly
    packets.path = packets

    textures.files = ../Ankh/assets/textures/bridgewood.tga
    ../Ankh/assets/textures/coinPickup.tga
    ../Ankh/assets/textures/cube_lmap_1.tga
    ../Ankh/assets/textures/cube_lmap_2.tga
    ../Ankh/assets/textures/cube_lmap_3.tga
    ../Ankh/assets/textures/cube_lmap_4.tga
    ../Ankh/assets/textures/cube_lmap_5.tga
    ../Ankh/assets/textures/cube_lmap_6.tga
    ../Ankh/assets/textures/default_diffuse.tga
    ../Ankh/assets/textures/default_lm.tga
    ../Ankh/assets/textures/default_nm.tga
    ../Ankh/assets/textures/default_ramp.tga
    ../Ankh/assets/textures/forest_Tree_Bark.tga
    ../Ankh/assets/textures/overlay2x.tga
    textures.path =textures
    QMAKE_BUNDLE_DATA += packets textures@

    Two problems. One, I would prefer to use a wild card character like this:

    @packets.files = ../Ankh/assets/packets/*.gly
    packets.path = packets

    textures.files = ../Ankh/assets/textures/*.tga
    textures.path =textures
    QMAKE_BUNDLE_DATA += packets textures@

    but it doesn't like it. I thought I might just specify the folder and maybe it would get the hint to include everything in the folder like this:

    @packets.files = ../Ankh/assets/packets
    packets.path = packets

    textures.files = ../Ankh/assets/textures
    textures.path =textures
    QMAKE_BUNDLE_DATA += packets textures@

    It doesn't like that either.

    The second problem is the path. I wanted to specify a path that isn't relative to the project such as this:

    @packets.files = $(HOME)/toon/assets/packets/*.tga
    packets.path = packets

    textures.files = $(HOME)/toon/assets/texture/*.tga
    textures.path =textures
    QMAKE_BUNDLE_DATA += packets textures@

    And it doesn't like that either! Anyone have any advice here?


  • Lifetime Qt Champion

    Hi,

    With Qt 5 you have the file function. Something like:

    @packets.files = $$files($(HOME)/toon/assets/packets/*.tga)@

    should do the job



  • You magnificient bast####! That worked! Thats why you are paid the big bucks! Thanks so much!

    Not to look a gift horse in the mouth, how/where did you read about this solution? I've looked and looked and finally had to shelf the problem.

    My final code now looks like this:

    @packets.files = $$files($(HOME)/toon/assets/packets/*.gly)
    packets.path = packets

    textures.files = $$files($(HOME)/toon/assets/textures/*.tga)
    textures.path =textures
    QMAKE_BUNDLE_DATA += packets textures@


  • Lifetime Qt Champion

    Big bucks ? Where ? :D

    You're welcome !

    I remembered that there already was a similar question once but "files" was not yet documented. It is now the Qt 5 qmake manual under Test Functions


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.