Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Copy directory structure to deployment folder



  • My source try includes audio files with identical names, in different directories. Eg:

    • assets/snd/page1/hello.wav
    • assets/snd/page2/hello.wav

    In order to deploy on ios I need to copy these files to the deployment (I think) directory.

    copydata.commands = $(COPY_DIR) $$PWD/assets/snd $$OUT_PWD/assets/snd
    first.depends = $(first) copydata
    export(first.depends)
    export(copydata.commands)
    QMAKE_EXTRA_TARGETS += first copydata
    

    So this works, but the files might be in the wrong place. I want them accessible from my QML program under assets/snd however, the above copies them to the BUILD directory. Does putting them in the build directory get them deployed?

    If not, how can I fix this?


  • Lifetime Qt Champion

    So your directly structure is the same but shifted in a different folder, correct ?

    The thing is: the bundle follows a pretty strict structure so your application might get rejected because of that. Nothing Qt specific.

    See here for the recommendations.


  • Lifetime Qt Champion

    Hi,

    See the iOS platform notes for the technique to bundle your files.



  • I tried that - I assume you mean:

    ios {
        fontFiles.files = $$files(fonts/*.ttf)
        fontFiles.path = fonts
        QMAKE_BUNDLE_DATA += fontFiles
    }
    

    The problem is that all the files get dumped into a single directory. Since I have identical file names this does not work. I need to preserve the directory structure

    I see an identical question asked here in 2015 but no answer.


  • Lifetime Qt Champion

    So your directly structure is the same but shifted in a different folder, correct ?

    The thing is: the bundle follows a pretty strict structure so your application might get rejected because of that. Nothing Qt specific.

    See here for the recommendations.



  • Interesting read...it the doc identifies where to put certain resources, but doesn't say where to put anything that doesn't fit their categories.

    So if that means sound (resource) files should reside in root of the app folder, then I suppose each resource must have a unique name. I'm hoping not to go back and redesign my app at this point. So I'll see what happens with current structure


  • Lifetime Qt Champion

    IIRCR there's one "Resources" folder that is one the same level as the folder containing the executable (or maybe one above) where you can put the various bits and pieces that are not Framework and plugins.

    Then all that would be required for you is to have a "prefix" that you configure using an ifdef and use it when needing to load these files.


Log in to reply