Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.15.0 RC2
-
None
Description
When I use the following code, the output results of these are different. Only QDir outputs the information of exist. When I look at the source code, I find that it is set to the current path when its constructor is empty. The problem arises from the fact that I am still judged to exist when I use the function call passed in QDir to return null value. I think it is unreasonable for such interface design, although the current path will be used when the QDIR structure is empty is written in the official document.
QString getConfig() { return ""; } int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); if (QDir(getConfig()).exists()) { qDebug() << "QDir exist"; } if (QFile((getConfig())).exists()) { qDebug() << "QFile exist"; } if (QFileInfo(getConfig()).exists()) { qDebug() << "QFileInfo exist"; } return app.exec(); }