PathHelper Class

Namespace
Kampute.DocToolkit.Support
Assembly
  • Kampute.DocToolkit.dll

Definition

Provides helper methods for working with file paths.
public static class PathHelper
Inheritance

Methods

EnsureValidRelativePath(string, string)Validates the specified path to ensure it is a relative path and does not contain invalid characters.
HasDotSegment(ReadOnlySpan<char>)Determines whether the specified path has any dot-segment (i.e., "." or "..").
IsSubpath(string, string)Determines if a sub-path is a valid sub-path of a full path.
NormalizePathSegments(IEnumerable<string>)Normalizes a collection of path segments by resolving relative segments like ".." and ".".
StartsWithDotSegment(ReadOnlySpan<char>)Determines if the specified path starts with a dot-segment (i.e., "." or "..").
TryNormalizePath(string, out string)Attempts to normalize the specified path by resolving relative segments like ".." and ".", and replacing backslashes with forward slashes.