Skip to content

Path.GetFileName behavior change on .NET Core #2644

Open
@JeremyKuhne

Description

@JeremyKuhne

In .NET Core we consider Path.GetPathRoot() when finding the filename. The concept of Path.VolumeSeparatorChar is only relevant on Windows 9x machines. So:

.NET Framework

The characters after the last directory separator character in path. If the last character of path is a directory or volume separator character, this method returns Empty.

.NET Core

The characters after the last directory separator character after the path root (see Path.GetPathRoot) in path. If the path only contains a root, returns empty.

We should add to Path.VolumeSeparatorChar that we recommend not using it directly as it is a Win9x anachronism. Use Path.GetPathRoot to determine path roots.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Pri1Indicates issues/PRs that are high priorityPri3Indicates issues/PRs that are low priorityarea-System.IO

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions