Table of Contents

Interface IAbsoluteFilePath

Namespace
NDepend.Path
Assembly
NDepend.API.dll

Represents an absolute path to a file on file system.

public interface IAbsoluteFilePath : IFilePath, IAbsolutePath, IPath
Inherited Members
Extension Methods

Remarks

The path represented can exist or not. The extension method ToAbsoluteFilePath(string) can be called to create a new IAbsoluteFilePath object from a string.

Property (1)

FileInfo

Returns a FileInfo object corresponding to this absolute file path.

FileInfo FileInfo { get; }

Property Value

FileInfo

Exceptions

FileNotFoundException

This absolute directory path doesn't refer to an existing directory.

See Also

Methods (4)

GetBrotherDirectoryWithName(string)

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

IAbsoluteDirectoryPath GetBrotherDirectoryWithName(string directoryName)

Parameters

directoryName string

The brother directory name.

Returns

IAbsoluteDirectoryPath

Remarks

This file nor the returned directory need to exist for this operation to complete properly.

GetBrotherFileWithName(string)

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

IAbsoluteFilePath GetBrotherFileWithName(string fileName)

Parameters

fileName string

The brother file name

Returns

IAbsoluteFilePath

Remarks

This file nor the returned file need to exist for this operation to complete properly.

TryGetRelativePathFrom(IAbsoluteDirectoryPath, out IRelativeFilePath, out string)

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

bool TryGetRelativePathFrom(IAbsoluteDirectoryPath pivotDirectory, out IRelativeFilePath relativeFilePath, out string failureReason)

Parameters

pivotDirectory IAbsoluteDirectoryPath

The pivot directory from which the relative path is computed.

relativeFilePath IRelativeFilePath

A new relative file path representing this file relative to 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.

UpdateExtension(string)

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

IAbsoluteFilePath UpdateExtension(string newExtension)

Parameters

newExtension string

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

Returns

IAbsoluteFilePath

Remarks

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