IFileSystem

Description

interface Tinman.Core.IO.Files.IFileSystem

Derived from

IDisposable
ICanCreateOpenDelete

Extended by

FileSystem abstract

The IFileSystem interface provides additional functionality for accessing directory trees.

Public / Methods

Directory​Create


public method DirectoryCreate → (1)

directoryPath in : Path

[not-null]
The directory path.

Creates the given directory.

If the given directory already exists, the method returns silently.

The method will create all ancestor directories if necessary.

IOException

If an I/O error has occurred.

Directory​Delete


public method DirectoryDelete → (1)

directoryPath in : Path

[not-null]
The path.

returns → bool

true if the directory has been deleted, false if it not.

Deletes the given directory iff it exists.

A directory can only be deleted if it is empty.

IOException

If an I/O error has occurred.

Directory​Exists


public method DirectoryExists → (1)

directoryPath in : Path

The directory path.

returns → bool

true if the directory exists, false if not.

Checks if the given directory exists.

IOException

If an I/O error has occurred.

Directory​Free​Space


public method DirectoryFreeSpace → (1)

directoryPath in : Path

[not-null]
The directory path.

returns → int64

The available storage space, in bytes. Will be 0 if the available storage space cannot be determined (for any reason, except IOExceptions).

Returns the estimated amount of storage space that is available in the given directory.

If the given directory does not exist, the storage space for the nearest existing ancestor directory is reported. The returned value is intended to be used for coarse-grained resource decisions.

IOException

If an I/O error has occurred.

Directory​Pop


public method DirectoryPop → ()

Pops the top-most directory from the internal stack and sets it as the current directory.

IOException

If an I/O error has occurred.

Directory​Push


public method DirectoryPush → (1)

directory in : Path

[not-null]
The new current directory.

Pushes the current directory onto an internal stack and sets the given directory in as current.

IOException

If an I/O error has occurred.

File​Delete


public method FileDelete → (1)

filePath in : Path

[not-null]
The file path.

returns → bool

true if the binary object has been deleted, false if it did not exist.

Permanently deletes a binary object.

IOException

If an I/O error has occurred.

File​Exists


public method FileExists → (1)

filePath in : Path

The path.

returns → bool

true if filePath in points to an existing binary object, false if not.

Checks if a binary object exists under the given path.

IOException

If an I/O error has occurred.

File​New


[OwnerReturn]
public method FileNew → (2)

filePath in : Path

[not-null]
The file path.

flags in : FileFlags

The file flags (creation disposition and behaviour flags).

returns → IFile

The created binary object.

Creates a new instance of IFile.

The IPathInfo.PathInfo property of the returned IFile will always be in canonical form.

IOException

If an I/O error has occurred.

See also

Path.Canonical

List​Directories


public method ListDirectories → (3)

directoryPath in : Path

[not-null]
The directory.

pattern opt : string = null

Optional name pattern using '?' and '*' wildcards.

caseSensitive opt : bool = true

Do case-sensitive comparison?

returns → Path [ ]

The list of canonical directory paths. The returned list order has no particular sort order.

Lists all subdirectories in the given directory.

The returned path names are absolute and fully resolved.

IOException

If an I/O error has occurred.

See also

Path.Canonical

List​Files


public method ListFiles → (3)

directoryPath in : Path

[not-null]
The directory.

pattern opt : string = null

Optional name pattern using '?' and '*' wildcards.

caseSensitive opt : bool = true

Do case-sensitive comparison?

returns → Path [ ]

The list of canonical file paths. The returned list order has no particular sort order.

Lists all files in the given directory.

The returned path names are absolute and fully resolved.

IOException

If an I/O error has occurred.

See also

Path.Canonical

Owns​Path


public method OwnsPath → (1)

path in : Path

[not-null]
The path object.

returns → bool

true if this filesystem should be used for the given path, false if not.

Does this filesystem own the given path?

Path​Validate


public method PathValidate → (1)

path in : Path

[not-null]
The path to validate.

returns → bool

true if all path characters are valid and all constraints are met,
false if at least one path character is invalid or one constraint is violated.

Validates the given path against invalid characters and possible custom constraints that may be imposed by the filesystem implementation.

If Path.IsTrailing returns true, the given path in will be interpreted as a directory path. Otherwise, it will be interpreted as a file path.

Rename


public method Rename → (2)

filePath in : Path

[not-null]
The path to the file or directory to rename.

name in : string

[not-empty]
The new file or directory name (see Path.Last).

returns → Path

The canonical path of the renamed file or directory.

Renames the given file or directory.

IOException

If an I/O error has occurred.

Public / Attributes

Directory


public attribute Directory → (get,set)

value : Path

[not-null]
The current directory in canonical form.

Gets or sets the current directory of this filesystem.

IOException

If an I/O error has occurred.

See also

Path.Canonical

Invalid​Characters


public attribute InvalidCharacters → (get)

value : IBagConst<char>

[not-null]
The set of characters that cannot be used in path elements or the root selector.

Returns the set of characters that must not be present in path elements and root selectors.

The Path class defines a grammar for valid path strings, which is applied when a Path object is created. A file system may impose additional restrictions on valid paths, for example by limiting the allowed characters for path elements and root selectors.

Maximum​Directory​Path​Length


public attribute MaximumDirectoryPathLength → (get)

value : int32

[>0]
The maximum directory path length, in characters (inclusive).

Returns the maximum total length of a path for a directory.

The path length is defined as Path.Length when Path.IsTrailing returns true.

Maximum​File​Path​Length


public attribute MaximumFilePathLength → (get)

value : int32

[>0]
The maximum file path length, in characters (inclusive).

Returns the maximum total length of a path for a file.

The path length is defined as Path.Length when Path.IsTrailing returns false.

Maximum​Path​Element​Length


public attribute MaximumPathElementLength → (get)

value : int32

[>0]
The maximum path element length, in characters (inclusive).

Returns the maximum length of a single path element.

Roots


public attribute Roots → (get)

value : Path [ ]

[not-null]
The root nodes.

Returns the root nodes of this filesystem.

IOException

If an I/O error has occurred.

Extensions

Path​Validate​Throw


public static method PathValidateThrow → (2)

source in : string

The error source tag.

path in : Path

[not-null]
The path to validate.

Validates the given path against the invalid characters.

IOException

If at least one path character is invalid.