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

Regression: QFile::write fails to report error.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P2: Important
    • 4.7.0
    • 4.4.0
    • Core: I/O
    • None

    Description

      This looks like it might be related to task 107448, might be a regression and probably is Windows platform specific.

      Update: QFile is capable of opening a file for write on a directory that doesn't exist.

      Test case that should return 2 if directory x doesn't exist.
      ==================================
      #include <QtGui>
      class MainWidget : public QWidget {
      Q_OBJECT
      public:
      MainWidget();
      int foo();
      };

      int MainWidget::foo()

      { QFile writeFile("x:\out.txt"); if(!writeFile.open(QIODevice::WriteOnly)) return false; writeFile.write("foo..."; return writeFile.error()==QFile::WriteError; }

      MainWidget::MainWidget()

      { qDebug() << foo(); }

      int main(int argc, char *argv[]){
      QApplication app(argc, argv);
      MainWidget mainWid;
      //mainWid.show();
      return app.exec();
      }

      #include "main.moc"

      Attachments

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

        Activity

          People

            biochimia João Abecasis
            engvolds Morten Engvoldsen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes