Qt World Summit: Submit your Presentation

Mac OSX folders needed by application

  • What is the best way to reference and use folders on a Mac in Qt ? I'm finding that the ApplicationDirPath is coming back with some extra folders in the path name which is messing up finding associated folders relative to Windows and Linux .


  • I have dealt with this in the past . Because of osx bundle madness. I wrote a helper function that just uses QString and cuts off the bundle madness. Alternatively if you are asking about system wide paths take a look at QStanderedPaths .

  • I have an application and some associated files. First I was just putting them an folder , app and associated folders. On windows it is easy to reference these folders based on the location of the application . On Mac I get an extra mess for the application path. Could you share your helper function ideas ? This seems like something that should be standard in Qt, if it's going to be truly Cross Platform.

  • Lifetime Qt Champion


    What folders do you have in mind ?
    Where are you putting them ?
    What is your use of them ?

  • Right now I'm just building, and the application couldn't fine the folders

    Have a
    Bin folder with application
    Menu folder that builds a dynamic menu
    Des folder that has some information
    Image that has images to display

    I added CONFIG -= app_bundle to .pro file and now running the app finds the folders..

    I guess I could have a predefined folder for Mac and Windows somewhere

  • Lifetime Qt Champion

    Where are you storing them on Windows and Linux ?

  • On Windows and Linux it's the same folder as application ..

  • Lifetime Qt Champion

    Image and Des folder looks like static content, right ?
    What about Menu ? Is it something your user can modify ?

  • Right image and des is static content, but would likely be changed with minor updates.

    One menu is built from menu files. This will probably go into a dialog for selection rather than menu.
    One of the menus the user can customize.

  • Lifetime Qt Champion

    Then regardless of the OS, you should put that user customizable subfolder in the QStandardPaths::AppConfigLocation.

    The other folders content will be updated when you provide a new version of the application.

    In any case, don't put anything user editable in the same folder as the binary. On Windows, the folder is read-only, and it should be the same on Linux.

  • Thanks, I'll try that

Log in to reply