Thanks to visit codestin.com
Credit goes to github.com

Skip to content

On Windows scandir handles paths different from other filesystem APIs #150880

Description

@ChrisDenton

Python has to append \\* to the path before calling FindFirstFileW. This slightly changes how paths are parsed by the OS.

I think our policy of "as close to the OS behaviour as is portable" still applies here, but because we're the ones appending \\* to the path for scandir, trimming spaces first isn't unreasonable. I'd rather use an API that doesn't involve us modifying the path, but if that doesn't exist, then we don't have a lot of choice.

But since the original issue was opened for "what's the general policy on this" and that's been answered, let's start a new issue specifically for scandir.

Originally posted by @zooba in #115104

To fix this, GetFullPathNameW could be used before appending \\* to the path and calling FindFirstFileW. This will create a normalized absolute path without changing the meaning of the path (as far as the OS is concerned). So it'll be consistent with other filesystem APIs.

Linked PRs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions