Is there an easy way of recursively copying files with QMAKE_BUNDLE_DATA?



  • I have a recursive directory structure I'd like to copy into OSX/iOS app bundles. For example

    MyStuff/
      Mystuff/dir0/
        Mystuff/dir0/file0
        Mystuff/dir0/file1
      Mystuff/dir1/
        Mystuff/dir1/file2
        Mystuff/dir1/file3
    

    I have no problem doing this directory by directory with

      MYSTUFF_DIR0.path = MyStuff/dir0
      MYSTUFF_DIR0.files += $$files(MyStuff/dir0/file*)
      QMAKE_BUNDLE_DATA +=  MYSTUFF_DIR0
      MYSTUFF_DIR1.path = MyStuff/dir1
      MYSTUFF_DIR1.files += $$files(MyStuff/dir1/file*)
      QMAKE_BUNDLE_DATA +=  MYSTUFF_DIR1
    

    but as directory hierarchies become deeper this gets painful.

    An obvious solution looked like it might be to use the recursive option of $$files:

      MYSTUFF.path = MyStuff/
      MYSTUFF.files += $$files(Mystuff/*,true)
      QMAKE_BUNDLE_DATA +=  MYSTUFF_DIR0
    

    but all that does is flatten the files into MyStuff/file0, MyStuff/file1, MyStuff/file2, MyStuff/file3 which isn't what I want.

    Is there an easy trick for doing this?

    Yes I do know about qrc files! Normally they'd be my first choice for including this sort of data (a few lines of script can generate the .qrc XML), but in this case I have good reason for wanting to keep the .app's data out of a qrc: my collaborators like to be able to hack on the files in the built osx app bundle to try out changes.


Log in to reply
 

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