reckfellENGINE

DirAccess

Directory opening and file enumeration with explicit error handling.

On this page
class DirAccessReckfellSharpInherits RefCounted

Open an existing directory with Open(), check null and immediately GetOpenError(), and release your owned handle with using. Use user:// for game progress; use ResourceLoader for imported resources instead of assuming original files remain available after export.

GetFiles()/GetDirectories() return sorted immediate names, without recursion. For enumeration with an explicit start result, use ListDirBegin(), GetNext(), CurrentIsDir() and ListDirEnd() in finally on early exit. Bulk listing uses the same cursor: do not mix both styles on one handle.

IncludeHidden/IncludeNavigational filter enumeration, not access to paths. Static listing uses a fresh handle with default flags. GetOpenError() is thread-local and does not report ChangeDir() or arbitrary filesystem-operation errors.

Twenty-five Windows opening/listing checks ran in an isolated project. Export/PCK, other OSes, permissions, links, file mutations and temporary-directory lifecycle remain untested. These are this section verification limits, not claims that those functions are absent.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Properties2

IncludeHiddenProperty
# IncludeHidden
C#
public bool IncludeHidden { get; set; }

Includes hidden entries when enumerating through this handle; defaults to false. A listing filter, not a restriction on FileExists/DirExists or an access control. Hidden classification is backend-defined: Windows uses FILE_ATTRIBUTE_HIDDEN, so a dot-prefixed name alone is not a portable test. Static GetFilesAt/GetDirectoriesAt use fresh default filters.

IncludeNavigationalProperty
# IncludeNavigational
C#
public bool IncludeNavigational { get; set; }

Includes navigational entries . and .. when enumerating through this handle; defaults to false. Does not govern an explicit ChangeDir("..") within the supported scope. Do not treat these entries as ordinary subdirectories in a recursive algorithm; other handle flags are independent.

Methods42

ChangeDirError
# ChangeDir
C#
public Error ChangeDir(string toDir);

Changes this handle current directory only. Relative paths resolve against GetCurrentDir(); the destination must exist. Use a new Open() for another access scope. Check its returned Error; GetOpenError() is not updated. Windows testing confirmed the old directory survives failure.

Parameters
NameTypeDefault
toDirstring—
toDir

Existing directory relative to the current path or a full path in the supported access scope.

Returns Error

Error.Ok when changed; another Error on failure.

CopyError
# Copy
C#
public Error Copy(string from, string to, int chmodFlags = -1);

Copies one file content through FileAccess. Unlike other instance operations, arguments pass directly to FileAccess without rebasing to DirAccess current directory; relative paths can address a different location. Use full paths or CopyAbsolute(). Opens the destination for writing and overwrites it; creates no parents. Copies no directory and guarantees neither atomicity nor preservation of an old destination on failure. chmodFlags concerns Unix permissions, not full ACL preservation.

Parameters
NameTypeDefault
fromstring—
tostring—
chmodFlagsint-1
from

Source path; for Copy supply a full path rather than relying on this handle current directory.

to

Destination path; an existing file can be overwritten/deleted. Use a full path for Copy.

chmodFlags

Unix permission bits for the destination; -1 leaves them unspecified. ERR_UNAVAILABLE on a platform without chmod does not turn a successful copy into failure.

Returns Error

Copy/permissions result Error; not an atomic-save guarantee.

CopyAbsoluteError
# CopyAbsolute
C#
public static Error CopyAbsolute(string from, string to, int chmodFlags = -1);

Copies one file content through FileAccess. Unlike other instance operations, arguments pass directly to FileAccess without rebasing to DirAccess current directory; relative paths can address a different location. Use full paths or CopyAbsolute(). Opens the destination for writing and overwrites it; creates no parents. Copies no directory and guarantees neither atomicity nor preservation of an old destination on failure. chmodFlags concerns Unix permissions, not full ACL preservation. The static variant first globalizes asset:// and user:// through ProjectSettings.GlobalizePath(); it does not depend on another DirAccess current directory.

Parameters
NameTypeDefault
fromstring—
tostring—
chmodFlagsint-1
from

Source path; for Copy supply a full path rather than relying on this handle current directory.

to

Destination path; an existing file can be overwritten/deleted. Use a full path for Copy.

chmodFlags

Unix permission bits for the destination; -1 leaves them unspecified. ERR_UNAVAILABLE on a platform without chmod does not turn a successful copy into failure.

Returns Error

Copy/permissions result Error; not an atomic-save guarantee.

CreateLinkError
# CreateLink
C#
public Error CreateLink(string source, string target);

Creates a symbolic link at target pointing to source: target is the new link path, not a copy destination. Copies no content and creates no parents. Windows requests unprivileged creation from the OS, but success still depends on environment/permissions; check Error. Source existence guarantees neither link creation nor accessibility. Actual link creation was not executed.

Parameters
NameTypeDefault
sourcestring—
targetstring—
source

Path the new link should point to; not content to copy.

target

Path of the new link; its parent must exist.

Returns Error

Error.Ok when created or an OS/backend error.

CreateTempDirAccess
# CreateTemp
C#
public static DirAccess CreateTemp(string prefix = "", bool keep = false);

Creates a directory in OS temp and returns an owned RefCounted handle. prefix is a filename prefix, not a path. On null immediately read GetOpenError() on the same thread. With keep=false, releasing the last native reference attempts recursive removal of the original temporary directory; ChangeDir() does not change the cleanup target. Cleanup is best-effort, not guaranteed on failure/process termination. keep=true preserves the directory after release. C# using releases your reference; other owners can extend its lifetime. Lifecycle was source-reviewed only here.

Parameters
NameTypeDefault
prefixstring""
keepboolfalse
prefix

Valid directory-name prefix without path separators; empty is allowed.

keep

True preserves the original temp directory after handle release; false enables best-effort cleanup on the last native reference.

Returns DirAccess

Owned temporary DirAccess or null; GetOpenError() provides the opening/creation error.

CurrentIsDirbool
# CurrentIsDir
C#
public bool CurrentIsDir();

Classifies the last nonempty entry returned by GetNext(). Call immediately after GetNext(), before another read. Does not test an arbitrary path; do not treat the value before the first read or after completion as file information.

Returns bool

True for a directory in the last returned entry; false for a file.

DirExistsbool
# DirExists
C#
public bool DirExists(string path);

Tests a directory relative to this handle current directory or at a supported absolute path. IncludeHidden/IncludeNavigational do not restrict it. A file is not a directory; creates nothing and guarantees no future access if the filesystem changes.

Parameters
NameTypeDefault
pathstring—
path

Directory path; use a full path or asset:// or user:// for a static call. Relative paths resolve against this handle current directory.

Returns bool

True if the backend sees a directory; a regular file gives false.

DirExistsAbsolutebool
# DirExistsAbsolute
C#
public static bool DirExistsAbsolute(string path);

Tests a directory through a fresh internal handle selected by path prefix. Supply a full OS path or asset:// or user:// to avoid dependence on OS working directory. Creates nothing and proves no write permission.

Parameters
NameTypeDefault
pathstring—
path

Directory path; use a full path or asset:// or user:// for a static call.

Returns bool

True for a backend-accessible directory; false is not a detailed error code.

FileExistsbool
# FileExists
C#
public bool FileExists(string path);

Tests a file relative to this handle current directory or at a supported absolute path. A directory is not a file. IncludeHidden does not affect this test. False does not distinguish absence from inaccessibility; true neither guarantees a later Open() nor replaces ResourceLoader for imported resources.

Parameters
NameTypeDefault
pathstring—
path

File path to test. Relative paths resolve against this handle current directory.

Returns bool

True if the backend sees a file at the path; a directory gives false.

GetCurrentDirstring
# GetCurrentDir
C#
public string GetCurrentDir(bool includeDrive = true);

Current directory path of this handle. Resource/user-data access retains asset:// or user:// rather than necessarily returning an OS path. includeDrive=false controls drive-name display; it does not convert to a project-relative path.

Parameters
NameTypeDefault
includeDrivebooltrue
includeDrive

Include the drive name in filesystem paths when the backend supports it; defaults to true.

Returns string

Current handle path; may contain asset:// or user://.

GetCurrentDriveint
# GetCurrentDrive
C#
public int GetCurrentDrive();

Index for this handle current path in the backend drive list. The base algorithm matches a path prefix and falls back to 0 when none matches. Thus asset:// returned 0 on the tested Windows host; it is not reliable physical project-volume identification. Open a separate filesystem handle for a physical path and handle drive-list changes.

Returns int

Backend index; 0 may be a no-matching-path fallback.

GetDirectoriesstring[]
# GetDirectories
C#
public string[] GetDirectories();

Returns sorted immediate subdirectory names, not a recursive tree. Respects IncludeHidden and IncludeNavigational: enabled navigation may include . and ... Uses and consumes the same cursor as GetNext(); an empty array is not a separate listing-success status.

Returns string[]

New C# string[] of sorted directory names respecting flags.

GetDirectoriesAtstring[]
# GetDirectoriesAt
C#
public static string[] GetDirectoriesAt(string path);

Returns sorted immediate subdirectory names through a fresh internal handle with default filters. Does not inherit another handle navigation/hidden settings. Opening failure returns an empty array with a diagnostic; call Open() first for explicit error handling.

Parameters
NameTypeDefault
pathstring—
path

Directory path; use a full path or asset:// or user:// for a static call.

Returns string[]

Sorted subdirectory names; an empty array can also indicate failure.

GetDriveCountint
# GetDriveCount
C#
public static int GetDriveCount();

Number of drives/entry points enumerated by the OS backend. Windows lists logical lettered drives, not physical storage devices. The list can change between calls; an index is not a persistent drive ID. Being listed proves neither media readiness nor write permission.

Returns int

Backend list entry count; not physical disk count.

GetDriveLabelstring
# GetDriveLabel
C#
public static string GetDriveLabel(int idx);

Display label of a volume, not its path or a unique ID. Windows may return an empty label; network drives use the string <network>. Other backends may inherit an empty base result. This is not an Open() path; use GetDriveName() for that.

Parameters
NameTypeDefault
idxint—
idx

Index from 0 to GetDriveCount()-1; not a persistent ID. Handle list changes between calls.

Returns string

Volume label, empty string or platform display text; not a path.

GetDriveNamestring
# GetDriveName
C#
public static string GetDriveName(int idx);

Name/path of an OS list entry by index. Windows returns a form such as C:, not a volume display label. Use GetDriveLabel() separately for that label. Obtain a current GetDriveCount() and handle an empty result; count and name calls are not an atomic snapshot.

Parameters
NameTypeDefault
idxint—
idx

Index from 0 to GetDriveCount()-1; not a persistent ID. Handle list changes between calls.

Returns string

Name/path at the index or empty string; Windows uses forms such as C:.

GetFilesstring[]
# GetFiles
C#
public string[] GetFiles();

Returns sorted immediate file names, without recursion or full paths. Respects IncludeHidden. Starts and consumes the same cursor as GetNext(), interrupting manual enumeration on this handle. Empty array does not distinguish an empty directory from a listing-start error; use ListDirBegin() for an explicit Error.

Returns string[]

New C# string[] of sorted file names; not a recursive listing.

GetFilesAtstring[]
# GetFilesAt
C#
public static string[] GetFilesAt(string path);

Opens a fresh internal handle and returns sorted immediate file names. Uses that handle default filters, not IncludeHidden from an existing instance. Opening failure emits a diagnostic and returns an empty array; this neither proves an empty directory nor makes GetOpenError() this operation result.

Parameters
NameTypeDefault
pathstring—
path

Directory path; use a full path or asset:// or user:// for a static call.

Returns string[]

Sorted file names; an empty array can also indicate failure.

GetFilesystemTypestring
# GetFilesystemType
C#
public string GetFilesystemType();

Filesystem description for the current directory, such as NTFS; not a stable capability enum. Windows uses Network Share for a network path, and failures may produce an empty string. Do not infer permissions, atomic rename, case sensitivity or speed from the name; check the needed operation separately.

Returns string

Filesystem type description or empty string when unavailable.

GetIncludeHiddenbool
# GetIncludeHidden
C#
public bool GetIncludeHidden();

Includes hidden entries when enumerating through this handle; defaults to false. A listing filter, not a restriction on FileExists/DirExists or an access control. Hidden classification is backend-defined: Windows uses FILE_ATTRIBUTE_HIDDEN, so a dot-prefixed name alone is not a portable test. Static GetFilesAt/GetDirectoriesAt use fresh default filters.

Returns bool

Current IncludeHidden value of this handle.

GetIncludeNavigationalbool
# GetIncludeNavigational
C#
public bool GetIncludeNavigational();

Includes navigational entries . and .. when enumerating through this handle; defaults to false. Does not govern an explicit ChangeDir("..") within the supported scope. Do not treat these entries as ordinary subdirectories in a recursive algorithm; other handle flags are independent.

Returns bool

Current IncludeNavigational value of this handle.

GetNextstring
# GetNext
C#
public string GetNext();

Returns the next immediate entry name, not a full path. Empty string ends enumeration; order is unspecified. IncludeHidden/IncludeNavigational filter results. CurrentIsDir() describes the just-returned nonempty entry. Call ListDirEnd() on early exit.

Returns string

Nonempty entry name or empty string at end of enumeration.

GetOpenErrorError
# GetOpenError
C#
public static Error GetOpenError();

Last Open()/CreateTemp() result on the current thread, not a general filesystem error. A later call overwrites it. Do not use it to diagnose ChangeDir(), listing, Copy() or Remove(); inspect the operation result instead.

Returns Error

Last Open/CreateTemp Error on this thread; replaced by the next such call.

GetSpaceLeftulong
# GetSpaceLeft
C#
public ulong GetSpaceLeft();

Free bytes available to the caller on the current directory filesystem, not total disk capacity. Windows reads available bytes through GetDiskFreeSpaceExW; Unix uses f_bavail. The value can change immediately and reserves no space. Query failure also returns zero; this method supplies no separate Error.

Returns ulong

Available bytes; 0 can also mean query failure.

IsBundlebool
# IsBundle
C#
public bool IsBundle(string path);

Detects a file package where the backend supports that concept; macOS uses its system file-package query. The base implementation returns false, including the tested Windows backend. Does not identify .pck files, prefabs, asset archives or ResourceLoader compatibility.

Parameters
NameTypeDefault
pathstring—
path

Object path to query; use a full OS path or an appropriate handle virtual path for portability.

Returns bool

True for a backend-recognized file package; otherwise false.

IsCaseSensitivebool
# IsCaseSensitive
C#
public bool IsCaseSensitive(string path);

Queries the backend case-sensitivity policy for a path/directory. Windows queries a per-directory flag; macOS queries a volume property. Behavior is platform-dependent. False does not distinguish case-insensitivity from a failed query: a missing Windows path returns false. It proves neither existence nor access.

Parameters
NameTypeDefault
pathstring—
path

Object path to query; use a full OS path or an appropriate handle virtual path for portability.

Returns bool

Backend answer; false does not establish successful policy detection.

IsEquivalentbool
# IsEquivalent
C#
public bool IsEquivalent(string pathA, string pathB);

Compares backend file identity, but may fall back to literal equality of the original strings when metadata cannot be obtained. Identical nonexistent paths therefore return true; this is not an existence test. Windows uses file ID and volume, Unix device/inode. Supply full paths for portable calls: the current Unix implementation does not rebase relative arguments to this handle directory. It guarantees neither access nor identity after the call.

Parameters
NameTypeDefault
pathAstring—
pathBstring—
pathA

First full path to compare; do not assume existence without a separate check.

pathB

Second full path to compare; identical strings can match through fallback even with no file.

Returns bool

File-identity comparison result or string equality on fallback.

IsLinkbool
# IsLink
C#
public bool IsLink(string path);

Tests a special entry kind: Windows checks FILE_ATTRIBUTE_REPARSE_POINT, Unix a symlink. Windows true therefore does not mean only an ordinary symbolic link. Missing/inaccessible paths may also give false; no detailed Error is returned and subsequent traversal is not validated.

Parameters
NameTypeDefault
pathstring—
path

Object path to query; use a full OS path or an appropriate handle virtual path for portability.

Returns bool

Reparse-point/symlink query result; false is also possible on failure.

ListDirBeginError
# ListDirBegin
C#
public Error ListDirBegin();

Starts enumerating the current directory, resetting this handle previous cursor. Check Error before GetNext(). Do not call GetFiles()/GetDirectories() on the same handle mid-iteration: they begin and consume enumeration on that same cursor.

Returns Error

Error.Ok on enumeration start; otherwise do not continue with GetNext().

ListDirEndvoid
# ListDirEnd
C#
public void ListDirEnd();

Closes this handle current enumeration. Use on early exit, including through finally; another ListDirBegin() starts a fresh iteration. Does not close DirAccess itself or change its current directory.

MakeDirError
# MakeDir
C#
public Error MakeDir(string path);

Creates one directory. Instance-relative paths resolve from this handle current directory; missing parents are not created. Check Error: an existing directory normally gives AlreadyExists. Windows may also map AccessDenied to AlreadyExists, so that code alone proves no directory; check DirExists() separately. Does not change the current directory.

Parameters
NameTypeDefault
pathstring—
path

Directory path to create or file/empty directory for Remove. Use a full OS path or virtual path for a static call.

Returns Error

Error.Ok on creation; AlreadyExists/another Error requires checking the actual directory.

MakeDirAbsoluteError
# MakeDirAbsolute
C#
public static Error MakeDirAbsolute(string path);

Creates one directory. Instance-relative paths resolve from this handle current directory; missing parents are not created. Check Error: an existing directory normally gives AlreadyExists. Windows may also map AccessDenied to AlreadyExists, so that code alone proves no directory; check DirExists() separately. Does not change the current directory. The static variant creates an internal handle by path prefix; supply a full OS path or asset:// or user:// without depending on OS working directory.

Parameters
NameTypeDefault
pathstring—
path

Directory path to create or file/empty directory for Remove. Use a full OS path or virtual path for a static call.

Returns Error

Error.Ok on creation; AlreadyExists/another Error requires checking the actual directory.

MakeDirRecursiveError
# MakeDirRecursive
C#
public Error MakeDirRecursive(string path);

Creates intermediate directories, accepting AlreadyExists. Not transactional: parents already created remain on later failure. Empty path returns Ok without action. Current 1.0.0 can also return Ok when a file occupies the final path without creating a directory; reproduced in testing. Check DirExists() when a directory is required.

Parameters
NameTypeDefault
pathstring—
path

Directory path to create or file/empty directory for Remove. Use a full OS path or virtual path for a static call.

Returns Error

Error.Ok can also mean an empty path or a file at the final path; partial parents can remain on failure.

MakeDirRecursiveAbsoluteError
# MakeDirRecursiveAbsolute
C#
public static Error MakeDirRecursiveAbsolute(string path);

Creates intermediate directories, accepting AlreadyExists. Not transactional: parents already created remain on later failure. Empty path returns Ok without action. Current 1.0.0 can also return Ok when a file occupies the final path without creating a directory; reproduced in testing. Check DirExists() when a directory is required. The static variant creates an internal handle by path prefix; supply a full OS path or asset:// or user:// without depending on OS working directory.

Parameters
NameTypeDefault
pathstring—
path

Directory path to create or file/empty directory for Remove. Use a full OS path or virtual path for a static call.

Returns Error

Error.Ok can also mean an empty path or a file at the final path; partial parents can remain on failure.

OpenDirAccess
# Open
C#
public static DirAccess Open(string path);

Opens an existing directory and returns an owned RefCounted handle; use using in C#. Creates no directory. On null read GetOpenError() immediately on the same thread. Open another handle when switching asset://, user:// or filesystem access. Path availability depends on OS and export.

Parameters
NameTypeDefault
pathstring—
path

Existing directory: asset://, user:// or a supported OS path; not a file name.

Returns DirAccess

Owned DirAccess or null; inspect GetOpenError() immediately.

ReadLinkstring
# ReadLink
C#
public string ReadLink(string path);

Platform behavior differs. Windows obtains an opened object final OS path and can return a path even for an ordinary file; if opening fails it returns the fixed input path, which may also be nonempty. Unix reads symlink target text; it may be relative and is empty on failure. A nonempty string proves neither a link, successful resolution nor target existence. Actual symlinks/junctions were not tested in this pass.

Parameters
NameTypeDefault
pathstring—
path

Object path to query; use a full OS path or an appropriate handle virtual path for portability.

Returns string

Platform path/target text; not a universal successful-link-resolution indicator.

RemoveError
# Remove
C#
public Error Remove(string path);

Directly removes a file or empty directory, without moving it to trash. Not recursive: a nonempty directory remained and returned an error on the tested Windows host. Instance-relative paths resolve from this handle current directory. Check Error, not GetOpenError(); a missing path can also fail. Link behavior is backend-dependent; real links were not tested in this pass.

Parameters
NameTypeDefault
pathstring—
path

Directory path to create or file/empty directory for Remove. Use a full OS path or virtual path for a static call.

Returns Error

Error.Ok when removed; another Error does not supply its detailed cause through GetOpenError().

RemoveAbsoluteError
# RemoveAbsolute
C#
public static Error RemoveAbsolute(string path);

Directly removes a file or empty directory, without moving it to trash. Not recursive: a nonempty directory remained and returned an error on the tested Windows host. Instance-relative paths resolve from this handle current directory. Check Error, not GetOpenError(); a missing path can also fail. Link behavior is backend-dependent; real links were not tested in this pass. The static variant creates an internal handle by path prefix; supply a full OS path or asset:// or user:// without depending on OS working directory.

Parameters
NameTypeDefault
pathstring—
path

Directory path to create or file/empty directory for Remove. Use a full OS path or virtual path for a static call.

Returns Error

Error.Ok when removed; another Error does not supply its detailed cause through GetOpenError().

RenameError
# Rename
C#
public Error Rename(string from, string to);

Renames/moves a file or directory; instance-relative paths resolve from this handle current directory. Critical Windows 1.0.0 limitation: it deletes an existing destination file before moving. With a missing source it can delete the destination and return an error; reproduced on disposable fixtures. Do not use existing-file replacement as a safe save transaction. Unix cross-device fallback uses copy/remove, also without atomicity guarantees. The engine was not repaired here.

Parameters
NameTypeDefault
fromstring—
tostring—
from

Source path; for Copy supply a full path rather than relying on this handle current directory.

to

Destination path; an existing file can be overwritten/deleted. Use a full path for Copy.

Returns Error

Result Error; a Windows failure does not guarantee preservation of an existing destination.

RenameAbsoluteError
# RenameAbsolute
C#
public static Error RenameAbsolute(string from, string to);

Renames/moves a file or directory; instance-relative paths resolve from this handle current directory. Critical Windows 1.0.0 limitation: it deletes an existing destination file before moving. With a missing source it can delete the destination and return an error; reproduced on disposable fixtures. Do not use existing-file replacement as a safe save transaction. Unix cross-device fallback uses copy/remove, also without atomicity guarantees. The engine was not repaired here. The static variant globalizes both paths but retains that Windows defect; Absolute does not mean safe replacement.

Parameters
NameTypeDefault
fromstring—
tostring—
from

Source path; for Copy supply a full path rather than relying on this handle current directory.

to

Destination path; an existing file can be overwritten/deleted. Use a full path for Copy.

Returns Error

Result Error; a Windows failure does not guarantee preservation of an existing destination.

SetIncludeHiddenvoid
# SetIncludeHidden
C#
public void SetIncludeHidden(bool enable);

Includes hidden entries when enumerating through this handle; defaults to false. A listing filter, not a restriction on FileExists/DirExists or an access control. Hidden classification is backend-defined: Windows uses FILE_ATTRIBUTE_HIDDEN, so a dot-prefixed name alone is not a portable test. Static GetFilesAt/GetDirectoriesAt use fresh default filters.

Parameters
NameTypeDefault
enablebool—
enable

True includes hidden entries in this handle listing; false excludes them.

SetIncludeNavigationalvoid
# SetIncludeNavigational
C#
public void SetIncludeNavigational(bool enable);

Includes navigational entries . and .. when enumerating through this handle; defaults to false. Does not govern an explicit ChangeDir("..") within the supported scope. Do not treat these entries as ordinary subdirectories in a recursive algorithm; other handle flags are independent.

Parameters
NameTypeDefault
enablebool—
enable

True allows . and .. in this handle listing; false excludes them.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.