The IFileSystem interface provides additional functionality for accessing directory trees.
interface
|
IFileSystem
|
extends
|
ICanCreateOpenDelete
|
||
IDisposable
|
|||||
base of
|
FileSystem
|
Is this object capable of creating new resources?
property
|
CanCreate
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
this
object
can
create
new
resources,
false
if
it
cannot.
|
||
inherited
|
ICanCreateOpenDelete.CanCreate
|
Is this object capable of deleting files?
property
|
CanDelete
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
this
object
can
delete
resources,
false
if
it
cannot. |
||
inherited
|
ICanCreateOpenDelete.CanDelete
|
Is this object capable of opening existing files?
property
|
CanOpen
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
this
object
can
open
existing
resources,
false
if
it
cannot.
|
||
inherited
|
ICanCreateOpenDelete.CanOpen
|
Gets or sets the current directory of this filesystem.
property
|
Directory
{
get
set
}
|
||
type
|
Path
|
||
value
|
|
The current directory. |
Remarks:
The returned directory will always be in canonical form (see Canonical ).
Returns the lifecycle state of this object.
property
|
LifecycleState
{
get
}
|
||
type
|
LifecycleState
|
||
value
|
The lifecycle state. | ||
inherited
|
ILifecycleState.LifecycleState
|
Returns the root nodes of this filesystem.
property
|
Roots
{
get
}
|
||
type
|
Path[]
|
||
value
|
|
The root nodes. |
Acquires a strong reference to this disposable object.
[OwnerReturn, ThreadSafe]
|
||||
method
|
AcquireTry
()
|
|||
type
|
IDisposable
|
|||
returns
|
this
if
a
new
strong
reference
has
been
acquired,
null
if
this
object
is
already
being
disposed.
|
|||
inherited
|
IDisposable.AcquireTry
|
Remarks:
The object will not be actually disposed by calls to Dispose when there is at least one strong reference left. Code that calls the AcquireTry method is responsible for calling the Dispose method accordingly.
This method is not intended to be used in performance-critical code. It should only be used to high-level resource management.
Creates the given directory.
method
|
DirectoryCreate
(Path directoryPath)
|
||
params
|
directoryPath
|
[not-null]
|
The directory path. |
Remarks:
If the given directory already exists, the method returns silently.
The method will create all ancestor directories if necessary.
Tries to deletes the given directory if it exists.
method
|
DirectoryDelete
(Path directoryPath)
|
||
type
|
bool
|
||
params
|
directoryPath
|
[not-null]
|
The path. |
returns
|
true
if
the
directory
has
been
deleted,
false
if
it
not. |
Remarks:
A directory can only be deleted if it is empty.
Checks if the given directory exists.
method
|
DirectoryExists
(Path directoryPath)
|
||
type
|
bool
|
||
params
|
directoryPath
|
The directory path. | |
returns
|
true
if
the
directory
exists,
false
if
not. |
Returns the amount of storage space that is available in the given directory.
method
|
DirectoryFreeSpace
(Path directoryPath)
|
||
type
|
int64
|
||
params
|
directoryPath
|
[not-null]
|
The directory path. |
returns
|
|
The available storage space, in bytes. |
Remarks:
If the given directory does not exist, the storage space for the nearest existing ancestor directory is reported.
Releases all resources held by this object if there are no more strong references to it, decrements the reference counter by one otherwise.
[Dispose, OwnerThis, ThreadSafe]
|
||||
method
|
Dispose
()
|
|||
inherited
|
IDisposable.Dispose
|
Remarks:
The Dispose method silently returns if the object has already been disposed.
Permanently deletes a binary object.
method
|
FileDelete
(Path filePath)
|
||
type
|
bool
|
||
params
|
filePath
|
[not-null]
|
The file path. |
returns
|
true
if
the
binary
object
has
been
deleted,
false
if
it
did
not
exist.
|
Checks if a binary object exists under the given path.
method
|
FileExists
(Path filePath)
|
||
type
|
bool
|
||
params
|
filePath
|
The path. | |
returns
|
true
if
filePath
points
to
an
existing
binary
object,
false
if
not.
|
Creates a new instance of IFile.
[OwnerReturn]
|
||||
method
|
FileNew
(Path filePath,
FileFlags flags)
|
|||
type
|
IFile
|
|||
params
|
filePath
|
[not-null]
|
The file path. | |
flags
|
The file flags (creation disposition and behaviour flags). | |||
returns
|
|
The created binary object. |
Remarks:
The PathInfo property of the returned IFile will always be in canonical form (see Canonical).
Lists all subdirectories in the given directory.
method
|
ListDirectories
(Path directoryPath,
string pattern = null)
|
||
type
|
Path[]
|
||
params
|
directoryPath
|
[not-null]
|
The directory. |
pattern
|
Optional
name
pattern
using
'?'
and
'*'
wildcards.
Defaults
to
null .
|
||
returns
|
|
The list of canonical directory paths. The returned list order has no particular sort order. |
Remarks:
The returned pathnames are absolute and fully resolved.
See also:
Path.CanonicalLists all files in the given directory.
method
|
ListFiles
(Path directoryPath,
string pattern = null)
|
||
type
|
Path[]
|
||
params
|
directoryPath
|
[not-null]
|
The directory. |
pattern
|
Optional
name
pattern
using
'?'
and
'*'
wildcards.
Defaults
to
null .
|
||
returns
|
|
The list of canonical file paths. The returned list order has no particular sort order. |
Remarks:
The returned pathnames are absolute and fully resolved.
See also:
Path.CanonicalDoes this filesystem own the given path?
method
|
OwnsPath
(Path path)
|
||
type
|
bool
|
||
params
|
path
|
[not-null]
|
The path object. |
returns
|
true
if
this
filesystem
should
be
used
for
the
given
path,
false
if
not.
|