Class Path
Represents a utility class for creating and managing platform-specific path abstractions.
public static class Path
- Inheritance
-
Path
- Inherited Members
Methods
Create(string, IPathEnvironment?)
Creates a platform-specific full path from the given string.
public static IPath Create(string path, IPathEnvironment? pathEnvironment = null)
Parameters
pathstringThe string path to convert.
pathEnvironmentIPathEnvironmentOptional environment to use for path resolution.
Returns
Create(string, PathPlatform, IPathEnvironment?)
Creates a platform-specific full path from the given string and platform.
public static IPath Create(string path, PathPlatform platform, IPathEnvironment? pathEnvironment = null)
Parameters
pathstringThe string path to convert.
platformPathPlatformThe platform type to use for path interpretation.
pathEnvironmentIPathEnvironmentOptional environment to use for path resolution.
Returns
Exceptions
- ArgumentNullException
Thrown when the platform is None.
CreatePure(string)
Creates a platform-specific pure path from the given string.
public static IPurePath CreatePure(string path)
Parameters
pathstringThe string path to convert.
Returns
CreatePure(string, PathPlatform)
Creates a platform-specific pure path from the given string and platform.
public static IPurePath CreatePure(string path, PathPlatform platform)
Parameters
pathstringThe string path to convert.
platformPathPlatformThe platform type to use for path interpretation.
Returns
Exceptions
- ArgumentNullException
Thrown when the platform is None.
CreateTempDirectory(string?)
Creates a uniquely named, empty directory in the current user's temporary directory.
public static IPath CreateTempDirectory(string? prefix = null)
Parameters
prefixstringAn optional prefix for the subdirectory name.
Returns
CreateTempFile()
Creates a uniquely named, zero-byte temporary file on disk and returns its path.
public static IPath CreateTempFile()
Returns
GetCurrentDirectory()
Gets the current working directory as a pure path.
public static IPath GetCurrentDirectory()
Returns
GetCurrentDirectoryPure()
Gets the current working directory as a pure path.
public static IPurePath GetCurrentDirectoryPure()
Returns
GetHomeDirectory()
Gets the current user's home directory as a pure path.
public static IPath GetHomeDirectory()
Returns
GetHomeDirectoryPure()
Gets the current user's home directory as a pure path.
public static IPurePath GetHomeDirectoryPure()
Returns
GetTempDirectory()
Gets the current user's temporary directory as a path.
public static IPath GetTempDirectory()
Returns
TryGetAssemblyExecutable(out IPath?, IPathEnvironment?)
Attempts to retrieve the current assembly's executable as an IPath.
public static bool TryGetAssemblyExecutable(out IPath? path, IPathEnvironment? pathEnvironment = null)
Parameters
pathIPathWhen this method returns, contains the path to the executable, if successful.
pathEnvironmentIPathEnvironmentOptional path environment for path resolution.
Returns
- bool
trueif successful; otherwise,false.
TryGetAssemblyExecutablePure(out IPurePath?, IPathEnvironment?)
Attempts to retrieve the current assembly's executable as a pure path.
public static bool TryGetAssemblyExecutablePure(out IPurePath? purePath, IPathEnvironment? pathEnvironment = null)
Parameters
purePathIPurePathWhen this method returns, contains the pure path to the executable, if successful.
pathEnvironmentIPathEnvironmentOptional path environment for path resolution.
Returns
- bool
trueif successful; otherwise,false.