Newbie asks: How to use working directory set in QtCreator
Hi!
I'm very new to QT and i have a question. I created a project and set the "Working directory" for debug via project settings to a path that is not the build-directory.
Is it possible to execute the code that follows so that it uses the "working directory":
QString dir;
QString styleSheet;
QString filename;
QFile styleFile;
dir = qApp->applicationDirPath();
qApp->applicationDirPath(); should point to my working directory. Is it somehow possible?
How would you deal with that? Use a build-dir and for execution a working directory?
Thank you very much!
Re: Newbie asks: How to use working directory set in QtCreator
You can't alter the applications dir path. See QDir::setCurrent() instead. (Also note your wiki [WIKI]Current working directory[/WIKI])
Re: Newbie asks: How to use working directory set in QtCreator
OK, thank you! So...i have to find out if in debug-build and set the dir manually with
#ifdef Q_DEBUG
exedir = "C:/Mydir";
#end
#else
exedir = App->applicationDirPath();
#end
Or is their a way to set the ouput of my exe only (no other files, exe only) to a specific directory?
Re: Newbie asks: How to use working directory set in QtCreator
What do you mean "output of my exe"? You mean the directory where the application should be built? That's controlled by the DESTDIR qmake variable.