Interface IRelativeDirectoryPath
Represents a relative directory path.
public interface IRelativeDirectoryPath : IDirectoryPath, IRelativePath, IPath
- Inherited Members
- Extension Methods
Remarks
The extension method ToRelativeDirectoryPath(string) can be called to create a new IRelativeDirectoryPath object from a string.
Methods (9)
GetBrotherDirectoryWithName(string)
Returns a new relative directory path representing a directory with name directoryName, located in the parent's directory of this directory.
IRelativeDirectoryPath GetBrotherDirectoryWithName(string directoryName)
Parameters
directoryNamestringThe brother directory name.
Returns
Exceptions
- InvalidOperationException
This relative directory path doesn't have a parent directory.
GetBrotherFileWithName(string)
Returns a new relative file path representing a file with name fileName, located in the parent's directory of this directory.
IRelativeFilePath GetBrotherFileWithName(string fileName)
Parameters
fileNamestringThe brother file name.
Returns
Exceptions
- InvalidOperationException
This relative directory path doesn't have a parent directory.
GetChildDirectoryWithName(string)
Returns a new relative directory path representing a directory with name directoryName, located in this directory.
IRelativeDirectoryPath GetChildDirectoryWithName(string directoryName)
Parameters
directoryNamestringThe child directory name.
Returns
GetChildFileWithName(string)
Returns a new relative file path representing a file with name fileName, located in this directory.
IRelativeFilePath GetChildFileWithName(string fileName)
Parameters
fileNamestringThe child file name.
Returns
TryGetAbsolutePathFrom(IAbsoluteDirectoryPath, out IAbsoluteDirectoryPath, out string)
Resolve this relative directory from pivotDirectory. If this directory is "..\Dir2" and pivotDirectory is "C:\Dir1\Dir3", the returned absolute directory is "C:\Dir1\Dir2".
bool TryGetAbsolutePathFrom(IAbsoluteDirectoryPath pivotDirectory, out IAbsoluteDirectoryPath absoluteDirectoryPath, out string failureReason)
Parameters
pivotDirectoryIAbsoluteDirectoryPathThe pivot directory from which the absolute path is computed.
absoluteDirectoryPathIAbsoluteDirectoryPathA new absolute directory path representing this relative directory resolved from
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.
Remarks
The returned file nor pivotDirectory need to exist for this operation to complete properly.
TryGetBrotherDirectoryWithName(string, out IRelativeDirectoryPath, out string)
Returns true if directoryName doesn't contain forbidden character in path.
bool TryGetBrotherDirectoryWithName(string directoryName, out IRelativeDirectoryPath directoryPath, out string failureReason)
Parameters
directoryNamestringThe brother directory name.
directoryPathIRelativeDirectoryPathThe directory path obtained.
failureReasonstringThe explanation in case this call returns false.
Returns
TryGetBrotherFileWithName(string, out IRelativeFilePath, out string)
Returns true if fileName doesn't contain forbidden character in path.
bool TryGetBrotherFileWithName(string fileName, out IRelativeFilePath filePath, out string failureReason)
Parameters
fileNamestringThe brother file name.
filePathIRelativeFilePathThe file path obtained.
failureReasonstringThe explanation in case this call returns false.
Returns
TryGetChildDirectoryWithName(string, out IRelativeDirectoryPath, out string)
Returns true if directoryName doesn't contain forbidden character in path.
bool TryGetChildDirectoryWithName(string directoryName, out IRelativeDirectoryPath directoryPath, out string failureReason)
Parameters
directoryNamestringThe child directory name.
directoryPathIRelativeDirectoryPathThe directory path obtained.
failureReasonstringThe explanation in case this call returns false.
Returns
TryGetChildFileWithName(string, out IRelativeFilePath, out string)
Returns true if fileName doesn't contain forbidden character in path.
bool TryGetChildFileWithName(string fileName, out IRelativeFilePath filePath, out string failureReason)
Parameters
fileNamestringThe child file name.
filePathIRelativeFilePathThe file path obtained.
failureReasonstringThe explanation in case this call returns false.