Skip to content

libstdc++ std::filesystem::path should recognize root paths from newlib #10

Description

@dkosmari

Feature Request

What feature are you suggesting?

Overview:

std::filesystem::path is hardcoded for supporting Windows (in addition to POSIX), to recognize what counts as a root name/path. See libstdc++-v3/src/c++17/fs_path.cc, the path::_Parser struct for details. Outside of Windows, the current implementation ignores root names (only a starting slash indicates root.)

But since newlib allows for devoptab entries to have a root name (e.g. on Wii U: fs:), it would be good to have support for this, so paths like fs:/vol/content/external01 could be recognized as absolute paths starting with a root name, instead of being misidentified as relative paths.

Smaller Details:

The implementation could be similar to the existing _GLIBCXX_FILESYSTEM_IS_WINDOWS fragments. The Windows version expects a single letter followed by the colon (e.g. C:) as the root name. For newlib, it would have to check the GetDeviceOpTab() function, to find if the root is a valid device name known by newlib.

Nature of Request:

  • Addition

Why would this feature be useful?

C++ software can check if a std::filesystem::path is absolute, and contains a root name. It's nice to have them work out of the box, when porting code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions