I'm writing a program using QtCreator that uses some files in a folder (data) in the same folder as the project folder. I'm working under linux.

In the constructor I have a line that is QFile file("./data/file.ext"). When I execute the program in the creator everything is fine.

However it fails when I launch it by double clicking the created executable because the the program thinks that it is in /home/user/Documents. (I checked by having a button that creates a message with the output of QDir::current().absoulutePath().

My question is why? and how can I change the working folder to the folder where the program executes?

Thank you very much for any input.