Interface IRelativeFilePath
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
directoryNamestringThe brother directory name.
Returns
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
fileNamestringThe brother file name
Returns
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
pivotDirectoryIAbsoluteDirectoryPathThe pivot directory from which the absolute path is computed.
absoluteFilePathIAbsoluteFilePathA new absolute file path representing this relative file 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.
UpdateExtension(string)
Returns a new relative file path representing this file with its file name extension updated to newExtension.
IRelativeFilePath UpdateExtension(string newExtension)
Parameters
newExtensionstringThe new file extension. It must begin with a dot followed by one or many characters.