dotnet / dotnet/dotnet-api-docs
`Path` documentation is Windows-centric
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
Many methods in `Path` have Windows-centric documentation.
For example, [Path.IsPathRooted](https://learn.microsoft.com/en-us/dotnet/api/system.io.path.ispathrooted) claims that a "rooted" path is one where "[...] the first character is a directory separator character such as "\", or if the path starts with a drive letter and colon (:)." This is correct for Windows, but is a lie for Unix-like systems. For those, a simple ["first character is a forward slash" check is all that's necessary](https://github.com/dotnet/runtime/blob/207f2bb27c188809339eeea6c8405dfc29a35859/src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.cs#L130-L141):
```cs
/* 130 */ public static bool IsPathRooted([NotNullWhen(true)] string? path)
/* 131 */ {
/* 132 */ if (path == null)
/* 133 */ return false;
/* 134 */
/* 135 */ return IsPathRooted(path.AsSpan());
/* 136 */ }
/* 137 */
/* 138 */ public static bool IsPathRooted(ReadOnlySpan path)
/* 139 */ {
/* 140 */ return path.Length > 0 && path[0] == PathInternal.DirectorySeparatorChar;
/* 141 */ }
```
Contributor guide
Assessment
This issue has not been assessed yet.