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

QDir::mkpath fails on Windows if the working directory is not on the same drive

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Done
    • Affects Version/s: 5.1.0 RC1
    • Fix Version/s: 5.1.0
    • Component/s: Core: I/O
    • Labels:
      None
    • Commits:
      74ca6034e413dc7ae8203d8eef1264357023d8af

      Description

      The fix for QTBUG-30046 (change 3e2cd8ef6f1ce4f46719890134c8bba9dbdb19ba) introduced a regression on Windows: depending on the current working directory, QDir::mkdir for an absolute path might fail.

      Analysis: The patch splits up the path, and calls ::CreateDirectory for every part. For absolute paths it starts with the drive letter, e.g. "D:". However, before calling CreateDirectory we call QFSFileEnginePrivate::longFileName(path), which is supposed to prefix a \\?\. Anyhow, since "D:" isn't a complete path it also tries to add the working directory at the end, if the working directory is on the same drive.

      If the working directory is on another drive, ::CreateDirectory is called with "\\?\D:\". This path, however, results in an windows error 5 - Access is denied.

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              kkohne Kai Köhne
              Reporter:
              kkohne Kai Köhne
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes