Struct gdnative_bindings_lily::Directory [−][src]
pub struct Directory { /* fields omitted */ }
Expand description
core class Directory
inherits Reference
(reference counted).
Official documentation
See the documentation of this class in the Godot engine’s official documentation. The method descriptions are generated from it and typically contain code samples in GDScript, not Rust.
Memory management
The lifetime of this object is automatically managed through reference counting.
Class hierarchy
Directory inherits methods from:
Safety
All types in the Godot API have “interior mutability” in Rust parlance.
To enforce that the official thread-safety guidelines are
followed, the typestate pattern is used in the Ref
and TRef
smart pointers,
and the Instance
API. The typestate Access
in these types tracks whether the
access is unique, shared, or exclusive to the current thread. For more information,
see the type-level documentation on Ref
.
Implementations
Creates a new instance of this object.
This is a reference-counted type. The returned object is automatically managed
by Ref
.
Changes the currently opened directory to the one passed as an argument. The argument can be relative to the current directory (e.g. newdir
or ../newdir
), or an absolute path (e.g. /tmp/newdir
or res://somedir/newdir
).
Returns one of the [enum Error] code constants (OK
on success).
Copies the from
file to the to
destination. Both arguments should be paths to files, either relative or absolute. If the destination file exists and is not access-protected, it will be overwritten.
Returns one of the [enum Error] code constants (OK
on success).
Returns whether the current item processed with the last [method get_next] call is a directory (.
and ..
are considered directories).
Returns whether the target directory exists. The argument can be relative to the current directory, or an absolute path.
Returns whether the target file exists. The argument can be relative to the current directory, or an absolute path.
Returns the absolute path to the currently opened directory (e.g. res://folder
or C:\tmp\folder
).
Returns the currently opened directory’s drive index. See [method get_drive] to convert returned index to the name of the drive.
On Windows, returns the name of the drive (partition) passed as an argument (e.g. C:
). On other platforms, or if the requested drive does not existed, the method returns an empty String.
On Windows, returns the number of drives (partitions) mounted on the current filesystem. On other platforms, the method returns 0.
Returns the next element (file or directory) in the current directory (including .
and ..
, unless skip_navigational
was given to [method list_dir_begin]).
The name of the file or directory is returned (and not its full path). Once the stream has been fully processed, the method returns an empty String and closes the stream automatically (i.e. [method list_dir_end] would not be mandatory in such a case).
On UNIX desktop systems, returns the available space on the current directory’s disk. On other platforms, this information is not available and the method returns 0 or -1.
Initializes the stream used to list all files and directories using the [method get_next] function, closing the current opened stream if needed. Once the stream has been processed, it should typically be closed with [method list_dir_end].
If skip_navigational
is true
, .
and ..
are filtered out.
If skip_hidden
is true
, hidden files are filtered out.
Default Arguments
skip_navigational
-false
skip_hidden
-false
Closes the current stream opened with [method list_dir_begin] (whether it has been fully processed with [method get_next] or not does not matter).
Creates a directory. The argument can be relative to the current directory, or an absolute path. The target directory should be placed in an already existing directory (to create the full path recursively, see [method make_dir_recursive]).
Returns one of the [enum Error] code constants (OK
on success).
Creates a target directory and all necessary intermediate directories in its path, by calling [method make_dir] recursively. The argument can be relative to the current directory, or an absolute path.
Returns one of the [enum Error] code constants (OK
on success).
Opens an existing directory of the filesystem. The path
argument can be within the project tree (res://folder
), the user directory (user://folder
) or an absolute path of the user filesystem (e.g. /tmp/folder
or C:\tmp\folder
).
Returns one of the [enum Error] code constants (OK
on success).
Deletes the target file or an empty directory. The argument can be relative to the current directory, or an absolute path. If the target directory is not empty, the operation will fail.
Returns one of the [enum Error] code constants (OK
on success).
Renames (move) the from
file to the to
destination. Both arguments should be paths to files, either relative or absolute. If the destination file exists and is not access-protected, it will be overwritten.
Returns one of the [enum Error] code constants (OK
on success).
Methods from Deref<Target = Reference>
Trait Implementations
type RefKind = RefCounted
type RefKind = RefCounted
Creates an explicitly null reference of Self
as a method argument. This makes type
inference easier for the compiler compared to Option
. Read more
Creates a new instance of Self
using a zero-argument constructor, as a Unique
reference. Read more
Performs a dynamic reference downcast to target type. Read more
Performs a static reference upcast to a supertype that is guaranteed to be valid. Read more
Creates a persistent reference to the same Godot object with shared thread access. Read more
unsafe fn assume_thread_local(&self) -> Ref<Self, ThreadLocal> where
Self: GodotObject<RefKind = RefCounted>,
unsafe fn assume_thread_local(&self) -> Ref<Self, ThreadLocal> where
Self: GodotObject<RefKind = RefCounted>,
Creates a persistent reference to the same Godot object with thread-local thread access. Read more
Creates a persistent reference to the same Godot object with unique access. Read more
Recovers a instance ID previously returned by Object::get_instance_id
if the object is
still alive. See also TRef::try_from_instance_id
. Read more
Auto Trait Implementations
impl RefUnwindSafe for Directory
impl UnwindSafe for Directory