Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Setting up release build viable directories in QtQuick
Qt 6.11 is out! See what's new in the release blog

Setting up release build viable directories in QtQuick

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 561 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jay_emissary
    wrote on last edited by
    #1

    Hi,
    I'm trying to deploy my qt app for a test run, but I have some paths in the app that need to be hard coded to work with the Miniaudio library. When I use windeployqt on a release build, "Sounds/testsoundA.wav" becomes invalid, due to how the folders are rearranged; the path no longer exists.

      
    // "Sounds/testsoundA.wav" will fail via release build
      ma_result soundResultA = ma_sound_init_from_file(&engine, "Sounds/testsoundA.wav", 0, &sfx, NULL, &testSoundA);
    

    Release build directories often differ from the directories in the debug build, so even though this runs in the debug build, I expect this to fail after I use windeployqt on the release build. How can I get hardcoded paths to work with the final release? Or if they won't, what can I do to have my c++ pick up on the new directory for my audio?

    CMAKE:

    qt_add_qml_module(appxxx
        URI xxx
        VERSION 1.0
        QML_FILES
            Main.qml
            UI.qml
            TestObject.qml
            CustomFonts.qml
        RESOURCES
    
            Sounds/testsoundA.wav
    
    }
    
    1 Reply Last reply
    0
    • J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by J.Hilk
      #2

      I would suggest, you use the Qt Ressourcen System:
      https://doc.qt.io/qt-6/resources.html

      that will bake your wav file into the executable and the path will always be the same. It's the solution if you work with read only access

      in a c++ backend you also have the option to use, https://doc.qt.io/qt-6/qstandardpaths.html and QStandardPaths::ApplicationsLocation and then relative paths


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      4
      • J Jay_emissary has marked this topic as solved on
      • J Offline
        J Offline
        Jay_emissary
        wrote on last edited by
        #3

        Awesome, thanks for the insight!

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved