公司名字大全最新,张家港网站推广优化,个人工作室网站模板,网站建设优化托管在qt-creator中debug的时候#xff0c;发现程序不能读写所在目录的配置文件#xff0c;资源文件。 Google了一下#xff0c;原来 运行程序的 工作目录 与 程序所在的目录是不同的概念。
跑跑这段代码就知道了#xff1a;
#include QDebug
#include QDirQ…在qt-creator中debug的时候发现程序不能读写所在目录的配置文件资源文件。 Google了一下原来 运行程序的 工作目录 与 程序所在的目录是不同的概念。
跑跑这段代码就知道了
#include QDebug
#include QDirQString strCurrentApplicationDirPathQCoreApplication::applicationDirPath();//获取应用的目录qDebug()strCurrentApplicationDirPath;QString strCurrentPathQDir::currentPath();//获取运行程序的工作目录qDebug()strCurrentPath;原来strCurrentPath位于strCurrentApplicationDirPath上层
在我的机器上的一个 application output
12:15:23: Starting D:\QT5SourceCode\build-Test-Desktop_Qt_5_12_5_MinGW_64_bit-Debug\debug\Test.exe ...
D:/QT5SourceCode/build-Test-Desktop_Qt_5_12_5_MinGW_64_bit-Debug/debug
D:/QT5SourceCode/build-Test-Desktop_Qt_5_12_5_MinGW_64_bit-Debug