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

QTemporaryFile does not work for Windows network paths

    XMLWordPrintable

    Details

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

      Description

      When using a template with an absolute Windows network path the opening of the QTemporaryFile fails because the path is not detected as an absolute path:

      QString absName = "\\\\localhost\\C$\\tmp.XXXXXX";
      QTemporaryFile tmp(absName);
      if (tmp.open())
      {
         tmp.close();
      }
      else
      {
         qDebug() << tmp.errorString();
      }
      

      QFileSystemEntry::isRelative() does not consider UNC paths such that QFileSystemEngine::absoluteName() adds the current working directory to the already absolute path.
      Using '/' as file separator seems to work by mistake.

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              heimrich Karsten Heimrich
              Reporter:
              elgerton Martin Elger
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: