#include <QCoreApplication> QString strDirPath = QCoreApplication::applicationDirPath(); QString strFilePath = QCoreApplication::applicationFilePath();
Tips:
QCoreApplication::applicationDirPath()
Returns the directory that contains the application executable.
返回包含当前项目的可执行文件的路径;
QCoreApplication::applicationFilePath();
Returns the file path of the application executable.
返回可执行文件的路径
e.g.:
可执行文件的的路径为"/home/MonroeLiu/project/test/bin/executable.exe";
则:
strDirPath = "/home/MonroeLiu/project/test/bin"; strFilePath = "/home/MonroeLiu/project/test/bin/executable.exe";