PDA

View Full Version : QT Creator Release location



hojoff79
28th January 2011, 03:50
I am trying to build a function into a program to open a file in the same folder. When I build the program from within the IDE does it open the file in the release folder in the "*-desktop-build/release" folder?

So basically if I drop a index.txt file into that release folder and then build the program in QT creator, will that relative address work?

boudie
28th January 2011, 14:20
You can use the static functions QDir::currentPath() and QDir::setCurrent() to do what you want.

ChrisW67
28th January 2011, 20:48
Or QCoreApplication::applicationDirPath() if you must always find the file relative to the application executable file regardless of what the current working directory is (there's a small chance this will fail though, see the docs). Another option is to include the file in the application resources and then you can always find it.