qt程序上级目录怎么表示?
qDebug()<<"current applicationDirPath: "<<QCoreApplication::applicationDirPath();执行后,得到current applicationDirPath:"C:/Qt_Study_Examples/ReadWriteINI/release"
可是我要的是 "C:/Qt_Study_Examples/ReadWriteINI"
./加了之后报错,不懂这玩意的语法。{:301_1008:},所以求助老仙们{:301_974:} QDir(applicationDirPath()).cd("..") QString getRunParentPath()
{
QString strPath = QCoreApplication::applicationDirPath();
QDir dir(strPath);
bool bSuccess = dir.cdUp();
if (bSuccess == true) {
strPath = dir.path() + "/";
}
return strPath;
}
转https://zhidao.baidu.com/question/446322321.html
又学会了2招。
页:
[1]