Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-46895

QDir::exists is not doing what was documented

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Not Evaluated Not Evaluated
    • None
    • 5.4.2
    • Documentation
    • None

      In the Qt documentation, for example in http://doc.qt.io/qt-5/qdir.html#exists it's written:

      QDir::exists(const QString & name) const

      Returns true if the file called name exists; otherwise returns false. [...]

      however, this code

      QString path="/etc/hosts";
      if (QDir(path).exists())
          qDebug() << path << "exists.";
      else
          qDebug() << path << "does not exist.";
      

      writes "does not exist", although the file exists.

      The documentation about QDir::exists in Qt4 and Qt5 should be changed ?

      Thanks!

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            docteam Qt Documentation Team
            ganton Ganton
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes