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

QFileInfo::isWritable returns true for directories with read-only attribute

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 4.8.7
    • Core: I/O
    • None
    • Windows 8.1 with MinGW

    Description

      With ntfs permission lookup not enabled QFileInfo::isWritable returns true for directories with read-only attribute set. This differs from the behaviour of older Qt versions (e.g. 4.5.3) where false was returned.

      Example:

        QDir tTestDir("C:\\Temp\\TestDir");
        if (tTestDir.mkpath(tTestDir.absolutePath()))
        {
          QFile::setPermissions(tTestDir.absolutePath(),
                                QFile::ReadOwner | QFile::ExeOwner |
                                QFile::ReadGroup | QFile::ExeGroup |
                                QFile::ReadUser | QFile::ExeUser |
                                QFile::ReadOther | QFile::ExeOther);
          if (QFileInfo(tTestDir.absolutePath()).isWritable())
            std::cout << qPrintable(tTestDir.absolutePath()) << " is writable"
                      << std::endl;
          else
            std::cout << qPrintable(tTestDir.absolutePath()) << " is not writable"
                      << std::endl;
          tTestDir.rmpath(tTestDir.absolutePath());
        }
      

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            MarkusF Markus Fischer
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes