QT Applicationpath and Debug folder
-
wrote on 1 May 2021, 19:56 last edited by pixbyte 5 Jan 2021, 20:01
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`? -
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`?wrote on 2 May 2021, 02:44 last edited by@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 Championwrote on 2 May 2021, 06:24 last edited by mrjj 5 Feb 2021, 06:25
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
1/3