Interface IAbsoluteDirectoryPath
Represents an absolute path to a directory on file system.
public interface IAbsoluteDirectoryPath : IDirectoryPath, IAbsolutePath, IPath
- Inherited Members
- Extension Methods
Remarks
The path represented can exist or not. The extension method ToAbsoluteDirectoryPath(string) can be called to create a new IAbsoluteDirectoryPath object from a string.
Properties (3)
ChildrenDirectoriesPath
Returns a read-only list of directory paths absolute matching directories contained in this directory.
IReadOnlyList<IAbsoluteDirectoryPath> ChildrenDirectoriesPath { get; }
Property Value
Exceptions
- DirectoryNotFoundException
This absolute directory path doesn't refer to an existing directory.
- See Also
ChildrenFilesPath
Returns a read-only list of file paths absolute matching files contained in this directory.
IReadOnlyList<IAbsoluteFilePath> ChildrenFilesPath { get; }
Property Value
Exceptions
- DirectoryNotFoundException
This absolute directory path doesn't refer to an existing directory.
- See Also
DirectoryInfo
Returns a DirectoryInfo object representing this absolute directory path.
DirectoryInfo DirectoryInfo { get; }
Property Value
Exceptions
- DirectoryNotFoundException
This absolute directory path doesn't refer to an existing directory.
- See Also
Methods (9)
GetBrotherDirectoryWithName(string)
Returns a new absolute directory path representing a directory with name directoryName, located in the parent's directory of this directory.
IAbsoluteDirectoryPath GetBrotherDirectoryWithName(string directoryName)
Parameters
directoryNamestringThe brother directory name.
Returns
Remarks
This directory nor the returned directory need to exist for this operation to complete properly.
Exceptions
- InvalidOperationException
This absolute directory path doesn't have a parent directory.
GetBrotherFileWithName(string)
Returns a new absolute file path representing a file with name fileName, located in the parent's directory of this directory.
IAbsoluteFilePath GetBrotherFileWithName(string fileName)
Parameters
fileNamestringThe brother file name.
Returns
Remarks
This directory nor the returned file need to exist for this operation to complete properly.
Exceptions
- InvalidOperationException
This absolute directory path doesn't have a parent directory.
GetChildDirectoryWithName(string)
Returns a new absolute directory path representing a directory with name directoryName, located in this directory.
IAbsoluteDirectoryPath GetChildDirectoryWithName(string directoryName)
Parameters
directoryNamestringThe child directory name.
Returns
Remarks
This directory nor the returned directory need to exist for this operation to complete properly.
Exceptions
- InvalidOperationException
This absolute directory path doesn't have a parent directory.
GetChildFileWithName(string)
Returns a new absolute file path representing a file with name fileName, located in this directory.
IAbsoluteFilePath GetChildFileWithName(string fileName)
Parameters
fileNamestringThe child file name.
Returns
Remarks
This directory nor the returned file need to exist for this operation to complete properly.
Exceptions
- ArgumentException
fileNamecontains forbidden character in path.
TryGetBrotherDirectoryWithName(string, out IAbsoluteDirectoryPath, out string)
Returns true if directoryName doesn't contain forbidden character in path.
bool TryGetBrotherDirectoryWithName(string directoryName, out IAbsoluteDirectoryPath directoryPath, out string failureReason)
Parameters
directoryNamestringThe brother directory name.
directoryPathIAbsoluteDirectoryPathThe directory path obtained.
failureReasonstringThe explanation in case this call returns false.
Returns
TryGetBrotherFileWithName(string, out IAbsoluteFilePath, out string)
Returns true if fileName doesn't contain forbidden character in path.
bool TryGetBrotherFileWithName(string fileName, out IAbsoluteFilePath filePath, out string failureReason)
Parameters
fileNamestringThe brother file name.
filePathIAbsoluteFilePathThe file path obtained.
failureReasonstringThe explanation in case this call returns false.
Returns
TryGetChildDirectoryWithName(string, out IAbsoluteDirectoryPath, out string)
Returns true if directoryName doesn't contain forbidden character in path.
bool TryGetChildDirectoryWithName(string directoryName, out IAbsoluteDirectoryPath directoryPath, out string failureReason)
Parameters
directoryNamestringThe child directory name.
directoryPathIAbsoluteDirectoryPathThe directory path obtained.
failureReasonstringThe explanation in case this call returns false.
Returns
TryGetChildFileWithName(string, out IAbsoluteFilePath, out string)
Returns true if fileName doesn't contain forbidden character in path.
bool TryGetChildFileWithName(string fileName, out IAbsoluteFilePath filePath, out string failureReason)
Parameters
fileNamestringThe child file name.
filePathIAbsoluteFilePathThe file path obtained.
failureReasonstringThe explanation in case this call returns false.
Returns
TryGetRelativePathFrom(IAbsoluteDirectoryPath, out IRelativeDirectoryPath, out string)
Compute this directory as relative from pivotDirectory. If this directory is "C:\Dir1\Dir2" and pivotDirectory is "C:\Dir1\Dir3", the returned relative directory is "..\Dir2".
bool TryGetRelativePathFrom(IAbsoluteDirectoryPath pivotDirectory, out IRelativeDirectoryPath relativeDirectoryPath, out string failureReason)
Parameters
pivotDirectoryIAbsoluteDirectoryPathThe pivot directory from which the relative path is computed.
relativeDirectoryPathIRelativeDirectoryPathA new relative directory path representing this directory relative to
pivotDirectory.failureReasonstringIf this method returns false, contains a plain-english message explaining why it failed.
Returns
- bool
true if the operation works, else returns false.