Table of Contents

Interface IRelativeFilePath

Namespace
NDepend.Path
Assembly
NDepend.API.dll

Represents a relative file path.

public interface IRelativeFilePath : IFilePath, IRelativePath, IPath
Inherited Members
Extension Methods

Remarks

The extension method ToRelativeFilePath(string) can be called to create a new IRelativeFilePath object from a string.

Methods (4)

GetBrotherDirectoryWithName(string)

Returns a new relative directory path representing a directory with name directoryName, located in the same directory as this file.

IRelativeDirectoryPath GetBrotherDirectoryWithName(string directoryName)

Parameters

directoryName string

The brother directory name.

Returns

IRelativeDirectoryPath

GetBrotherFileWithName(string)

Returns a new relative file path refering to a file with name fileName, located in the same directory as this file.

IRelativeFilePath GetBrotherFileWithName(string fileName)

Parameters

fileName string

The brother file name

Returns

IRelativeFilePath

TryGetAbsolutePathFrom(IAbsoluteDirectoryPath, out IAbsoluteFilePath, out string)

Resolve this relative file from pivotDirectory. If this file is "..\Dir2\File.txt" and pivotDirectory is "C:\Dir1\Dir3", the returned absolute file is "C:\Dir1\Dir2\File.txt".

bool TryGetAbsolutePathFrom(IAbsoluteDirectoryPath pivotDirectory, out IAbsoluteFilePath absoluteFilePath, out string failureReason)

Parameters

pivotDirectory IAbsoluteDirectoryPath

The pivot directory from which the absolute path is computed.

absoluteFilePath IAbsoluteFilePath

A new absolute file path representing this relative file resolved from pivotDirectory.

failureReason string

If this method returns false, contains a plain-english message explaining why it failed.

Returns

bool

true if the operation works, else returns false.

Remarks

The returned file nor pivotDirectory need to exist for this operation to complete properly.

UpdateExtension(string)

Returns a new relative file path representing this file with its file name extension updated to newExtension.

IRelativeFilePath UpdateExtension(string newExtension)

Parameters

newExtension string

The new file extension. It must begin with a dot followed by one or many characters.

Returns

IRelativeFilePath