Table of Contents

Class BaseAndSubDirectory

Namespace
Hi.Common.PathUtils
Assembly
HiGeom.dll

Represents a directory structure with a base directory and a subdirectory, providing methods for path manipulation and resolution.

public class BaseAndSubDirectory
Inheritance
BaseAndSubDirectory
Inherited Members
Extension Methods

Constructors

BaseAndSubDirectory()

Initializes a new instance of the BaseAndSubDirectory class with default base and subdirectory values (".").

public BaseAndSubDirectory()

BaseAndSubDirectory(BaseAndSubDirectory)

Initializes a new instance of the BaseAndSubDirectory class by copying values from another instance.

public BaseAndSubDirectory(BaseAndSubDirectory src)

Parameters

src BaseAndSubDirectory

The source instance to copy from

BaseAndSubDirectory(string, string)

Initializes a new instance of the BaseAndSubDirectory class with the specified base directory and subdirectory.

public BaseAndSubDirectory(string baseDirectory, string subDirectory)

Parameters

baseDirectory string

The base directory path

subDirectory string

The subdirectory path relative to the base directory

Properties

AbsoluteDirectory

Gets or sets the absolute directory path by combining the base directory and subdirectory. When setting, calculates the subdirectory as a relative path from the base directory.

public string AbsoluteDirectory { get; set; }

Property Value

string

Remarks

Returns null if the base directory is null.

BaseDirectory

Gets or sets the root directory of the path structure.

public string BaseDirectory { get; set; }

Property Value

string

IsPathUnderBaseDirectory

Gets a value indicating whether the absolute directory is a descendant of the base directory.

public bool IsPathUnderBaseDirectory { get; }

Property Value

bool

Remarks

Returns false if the base directory is null.

SubDirectory

Gets or sets the directory path relative to the base directory. The path is automatically normalized to use forward slashes.

public string SubDirectory { get; set; }

Property Value

string

Methods

GetAbsolutePath(string)

Gets the absolute path by combining the absolute directory with a file name.

public string GetAbsolutePath(string fileName)

Parameters

fileName string

The file name to append to the absolute directory path

Returns

string

The combined absolute path with forward slashes as directory separators, or null if the base directory is null