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

Allow QFile.copy() to already existing file (make it compatible with QTemporaryFile)

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Out of scope
    • Icon: Not Evaluated Not Evaluated
    • None
    • None
    • Core: I/O
    • None

      The simple idea to copy a file to a temporary file will not work with the following code:

      QFile* source_file;
      ...
      QTemporaryFile* tmp_file = new QTemporaryFile();
      tmp_file->open(); tmp_file->close(); //make name

      source_file->copy(tmp_file->fileName());

      Because tmp_file->open() generates an empty file, which lets QFile.copy() fail.

      Solution: allow copy() to already existing files (overwrite mode).

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

            thiago Thiago Macieira
            mscheerer Martin Scheerer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes