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

QDir::exists is not doing what was documented

    XMLWordPrintable

Details

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

    Description

      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!

      Attachments

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

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes