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

QFile::write() should not return true when QFile::open() returns false.

    XMLWordPrintable

Details

    Description

      QString stringMockText = "This file is generated by Qt.\n";
      bool boolOpenPermitted = file->open(QIODevice::WriteOnly | QIODevice::Text);
      qDebug() << "boolOpenPermitted:" << boolOpenPermitted;
      bool boolWritePermitted = file->write(stringMockText.toLatin1().constData());
      qDebug() << "boolWritePermitted:" << boolWritePermitted;
      
      "C:/Program Files"
      dir1.exists(): true
      boolOpenPermitted: false
      boolWritePermitted: true
      You are permitted to write.
      canWriteFile(&file1): true
      
      "C:/Program Files (x86)"
      dir2.exists(): true
      boolOpenPermitted: false
      boolWritePermitted: true
      You are permitted to write.
      canWriteFile(&file2): true
      

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            leonlee Leonard Lee
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes