Skip to content

Create directories under UNC and \\?\ paths on Windows - #3702

Open
b84330808 wants to merge 1 commit into
gabime:v1.xfrom
b84330808:fix-create-dir-unc
Open

b84330808 wants to merge 1 commit into
gabime:v1.xfrom
b84330808:fix-create-dir-unc

Conversation

@b84330808

Copy link
Copy Markdown

create_dir() gave up at the first path component it could neither find nor create. For a UNC path like \\server\share\logs, or a verbatim path like \\?\C:\logs / \\?\UNC\server\share\logs, the first components are \\server and \\?, which never exist as directories, so a missing log directory under them was never created and opening the log file failed.

Now a failure only counts for the last directory: the loop keeps going past such components and returns whether the full path could be found or created. Real failures still return false, since nothing below a failed directory can be created either. The EEXIST case from #3625 is kept.

Added a Windows test that creates a nested directory through a \\?\ path (UNC paths behave the same, but need a share to test against).

create_dir() walks the path from the start and gave up at the first
component it could neither find nor create. For a UNC path such as
\\server\share\logs, or a verbatim path such as \\?\C:\logs, the first
components are "\\server" and "\\?", which never exist as directories,
so the log directory was never created and opening the log file failed.

Keep going past such components and let the last directory decide the
result. Real failures still return false, since the directories below a
failed one cannot be created either.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@b84330808 b84330808 changed the title Create directories under UNC and \?\ paths on Windows Create directories under UNC and \\?\ paths on Windows Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant