|
1 |
| -using System.IO; |
2 |
| -#if FEATURE_SPAN |
3 |
| -using System; |
4 |
| -#endif |
5 |
| - |
6 |
| -namespace Testably.Abstractions.Testing.Helpers; |
| 1 | +namespace Testably.Abstractions.Testing.Helpers; |
7 | 2 |
|
8 | 3 | internal partial class Execute
|
9 | 4 | {
|
10 |
| - private class LinuxPath(MockFileSystem fileSystem) : NativePath(fileSystem) |
| 5 | + private class LinuxPath(MockFileSystem fileSystem) : SimulatedPath(fileSystem) |
11 | 6 | {
|
12 |
| -#if FEATURE_SPAN |
13 |
| - /// <inheritdoc cref="Path.IsPathRooted(ReadOnlySpan{char})" /> |
14 |
| - public override bool IsPathRooted(ReadOnlySpan<char> path) |
15 |
| - => IsPathRooted(path.ToString()); |
16 |
| -#endif |
| 7 | + /// <inheritdoc cref="IPath.AltDirectorySeparatorChar" /> |
| 8 | + public override char AltDirectorySeparatorChar => '/'; |
| 9 | + |
| 10 | + /// <inheritdoc cref="IPath.DirectorySeparatorChar" /> |
| 11 | + public override char DirectorySeparatorChar => '/'; |
| 12 | + |
| 13 | + /// <inheritdoc cref="IPath.PathSeparator" /> |
| 14 | + public override char PathSeparator => ':'; |
| 15 | + |
| 16 | + /// <inheritdoc cref="IPath.VolumeSeparatorChar" /> |
| 17 | + public override char VolumeSeparatorChar => '/'; |
| 18 | + |
| 19 | + /// <inheritdoc cref="IPath.GetInvalidFileNameChars()" /> |
| 20 | + public override char[] GetInvalidFileNameChars() => ['\0', '/']; |
| 21 | + |
| 22 | + /// <inheritdoc cref="IPath.GetInvalidPathChars()" /> |
| 23 | + public override char[] GetInvalidPathChars() => ['\0']; |
| 24 | + |
| 25 | + /// <inheritdoc cref="IPath.GetPathRoot(string?)" /> |
| 26 | + public override string? GetPathRoot(string? path) |
| 27 | + { |
| 28 | + if (string.IsNullOrEmpty(path)) |
| 29 | + { |
| 30 | + return null; |
| 31 | + } |
| 32 | + |
| 33 | + return IsPathRooted(path) |
| 34 | + ? $"{DirectorySeparatorChar}" |
| 35 | + : string.Empty; |
| 36 | + } |
| 37 | + |
| 38 | + /// <inheritdoc cref="IPath.GetTempPath()" /> |
| 39 | + public override string GetTempPath() |
| 40 | + => "/tmp/"; |
17 | 41 |
|
18 |
| - /// <inheritdoc cref="Path.IsPathRooted(string)" /> |
| 42 | + /// <inheritdoc cref="IPath.IsPathRooted(string)" /> |
19 | 43 | public override bool IsPathRooted(string? path)
|
20 | 44 | => path?.Length > 0 && path[0] == '/';
|
21 | 45 | }
|
|
0 commit comments