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

QT Applicationpath and Debug folder



  • In my project I use a subfolder Plugins. I try to access this folder in Debug mode but QT is not able to find this path.
    The problem is the folder is not part of the build folder. Exact this build folder is given back from "QCoreApplication::applicationDirPath()".
    Is there a way to tell QTCreator to use the project folder like itself is doing with linking libraries?
    To copy always the "Plugins" folder to the Debug folder is an unwanted hack.
    I think in all I need the same path as the projectfile $$PWD
    Any solution`?



  • @pixbyte Can you show your "Projects" tree? Fully expanded.
    Not sure how your "Plugin" folder relates to your primary project.
    Would it be something like "SUB_DIRS" scheme?


  • Lifetime Qt Champion

    Hi

    It is possible to get the project file location via

    (in .pro file)

    DEFINES += SRCDIR=\\\"$$PWD/\\\"
    

    So you can load it from there.

    However the more common approach is to copy the plugin to the build folder.
    either via the .pro file or manually.

    That way it will work the same when the app is deployed.
    ( the plugins are in the same relative path to the exe)

    If you use the project folder path, you must have another way to load them when out in the real world - as clearly the actual project folder path does not exist on other computers.

    https://stackoverflow.com/questions/3984104/qmake-how-to-copy-a-file-to-the-output/3984180#3984180


Log in to reply