How to find what directory QFile is opening files from
-
How do I know what directory the QFile class is finding my files to open? Is it possible to specify what local directory I want to pull files from?
-
Hi,
If you give QFile a relative path, QFile will use your Working Directory (also known as the Current Directory). You can use the "QDir":http://doc.qt.io/qt-5/qdir.html class to get and set your working directory. See QDir::currentPath() and QDir::setCurrentPath().
-
Hi,
If you path doesn't start with / on *nix system then it's relative to the current path. If you want to e.g. load file from directories in the same folder as your application you can use QCoreApplication::applicationDirPath() to build your paths