IFilePath Interface
This class contains information on a file, as well its name and path,
and handles relative and absolute (full) paths.
When path is relative, it can have a BaseFilePath, used to
expand the relative filepath to an absolute (full) path. If a
path is relative, and no BaseFilePath is specified, CurrentDirectory
is used as BaseFilePath.
Examples of legal paths:
- "c:\\MyDir\\MyFile.txt" - directory and file
- "c:\\MyDir" - only directory
- "MyDir\\MySubdir" - relative directory
- "\\\\MyServer\\MyShare" - network drive
Namespace: DHI.Mike1D.GenericAssembly: DHI.Mike1D.Generic (in DHI.Mike1D.Generic.dll) Version: 24.0.0.0 (11.1.1.1111)
public interface IFilePath
| BaseFilePath |
If the path is relative, a BaseFilePath can be set. If a
BaseFilePath is not set, then the CurrentDirectory will be used
as BaseFilePath. For absolute paths, BaseFilePath is ignored.
Only the directory part of the BaseFilePath is used.
|
| DirectoryName |
Gets the directory name of the filepath. It will return
relative or absolute directory, depending on whether the filepath
is relative or absolute.
|
| Extension |
Gets or alters the extension of the file. The extionsion
is returned with the dot, i.e., on the form ".ext".
If no extension exists, the empty string is returned.
If path is null, null is returned.
It can be set with or without the dot.
|
| FileName |
Gets/alters the filename including extension
|
| FileNameWithoutExtension |
Gets/alters the filename without the extension
|
| FullDirectoryName |
Gets the full directory name of the filepath. It will return
an absolute directory.
|
| FullFilePath |
Gets the full directory name of the filepath, including file name. It will return
an absolute directory.
|
| HasPath |
Return true if FilePath has a Path, false if empty.
|
| IsRelative |
Returns true if the FilePath is relative
|
| Path |
Get/set file name including path. The path can be absolute or relative.
|
| RelativeDirectoryName |
Gets the relative directory name of the filepath. It will return
a directory relative to BaseFilePath or CurrentDirectory.
|
| RelativeFilePath |
Gets the relative directory name of the filepath, including file name. It will return
a directory relative to BaseFilePath or CurrentDirectory.
|
| Clone |
Creates a deep clone of the FilePath
|
| ExtensionIs |
Return true if the extension of the file path is "extension".
The dot is a part of the extension, i.e. use as
fp.ExtensionIs(".txt")
|
| MakePathFull |
Make the Path absolute, based on either BaseFilePath or CurrentDirectory.
If path is already absolute, this has no effekt.
|
| MakePathRelative |
Make the Path relative, based on either BaseFilePath or CurrentDirectory.
If path is already relative, this has no effekt.
|