I\'m trying to open an xml file in the current location of the executable
QString path = QDir::currentPath();
path.append(\"/acc.xml\");
I found this discussion while searching for a similar solution. I think that the most portable way of opening an external file that has a fixed name (and no dialogs and the user are involved) is to use the Resource System.
In my case I created a new resource file with the prefix /config
and added the file (called settings.xml
). Inside the code, I don't need to use any path functions at all. I use the resource system instead. Thus a call like QFile file(":/config/settings.xml")
works fine. Using QT creator 2.0.1 and QT 4.7 on Windows.