Skip to content

"Magic Path" (\\?\) on windows does not work #27

Open
@helmesjo

Description

@helmesjo

The following snippet will not return the expected subdir:

// long path
auto dummy = std::filesystem::temp_directory_path() / "loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooonooooooooog" / "dummy" / "dummy";
// prefix with the magic '\\?\' shenanigans
dummy = std::filesystem::path("\\\\?\\" + dummy.string());

// directory is created fine
auto errorCode = std::error_code{};
std::filesystem::create_directories(dummy, errorCode);
assert(!errorCode);

// but globbing fails to find any subdirs. Shortening the path makes it work
const auto matchingEntries = glob::glob(dummy.parent_path().string() + "/*");
assert (!matchingEntries.empty());

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions