Interface IAbsoluteFilePath
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
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
directoryNamestringThe brother directory name.
Returns
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
fileNamestringThe brother file name
Returns
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
pivotDirectoryIAbsoluteDirectoryPathThe pivot directory from which the relative path is computed.
relativeFilePathIRelativeFilePathA new relative file path representing this file 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.
UpdateExtension(string)
Returns a new absolute file path representing this file with its file name extension updated to newExtension.
IAbsoluteFilePath UpdateExtension(string newExtension)
Parameters
newExtensionstringThe new file extension. It must begin with a dot followed by one or many characters.
Returns
Remarks
The returned file nor this file need to exist for this operation to complete properly.