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

QSaveFile unable to open UNC path to write on Windows

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.11.1
    • Fix Version/s: 6.1.1, 6.2.0 Alpha
    • Component/s: Core: I/O
    • Labels:
    • Environment:
      tested on Windows 7 and Windows 10
    • Platform/s:
      Windows
    • Commits:
      ec9e85656339dbc9e6918a1369c981cece7bc97d (qt/qtbase/dev) 9d0be7b1a920cd9d7ae949bc3dc14774a439b3d0 (qt/qtbase/6.0) ad12c3c40b07079d875f48027eef0786acef7de0 (qt/qtbase/6.1)

      Description

      QFile can successfully open a file to write with a UNC path. QSaveFile cannot open the same file. For example:

          QString path = QString( "\\\\drive\\dir\\myfile.txt" );
          qDebug() << "path=" << path;
          QFile f2( path );
          if ( f2.open( QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text ) )
          {
              qDebug() << "QFile ok";
          }
          else
          {
              qDebug() << "QFile f.error()=" << f2.error();
              qDebug() << "QFile f.errorString()=" << f2.errorString();
          }
      
          QSaveFile f( path );
          if ( f.open( QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text ) )
          {
              qDebug() << "QSaveFile ok";
          }
          else
          {
              qDebug() << "QSaveFile f.error()=" << f.error();
              qDebug() << "QSaveFile f.errorString()=" << f.errorString();
          }
      
      

      Returns:

      path= "\\\\drive\\dir
      myfile.txt"
      QFile ok
      QSaveFile f.error()= 5
      QSaveFile f.errorString()= "The system cannot find the path specified."

        Attachments

          Issue Links

          For Gerrit Dashboard: QTBUG-76228
          # Subject Branch Project Status CR V

            Activity

              People

              Assignee:
              heimrich Karsten Heimrich
              Reporter:
              oryxdigital Andy Brice
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews