Skip to content

ludus::foundation::filesystem::Directory

Ludus Wiki · API overview · Browse API

Class

Pins a host-selected trusted root on Windows, Linux, macOS or Emscripten MEMFS. Other targets return Unsupported. Browser roots belong to the session filesystem. Child symlinks and Windows reparse points are rejected at every component. This is not a sandbox against hostile renames, hard links or mount changes. Const operations require a stable lifetime.

Declared in modules/foundation/filesystem/include/ludus/foundation/filesystem/filesystem.hpp

#include <ludus/foundation/filesystem/filesystem.hpp>
class ludus::foundation::filesystem::Directory final

Methods

Directory

ludus::foundation::filesystem::Directory::Directory() noexcept=default
Creates an empty root owner.

Declared in modules/foundation/filesystem/include/ludus/foundation/filesystem/filesystem.hpp

~Directory

ludus::foundation::filesystem::Directory::~Directory() noexcept
Releases the root best-effort without logging.

Declared in modules/foundation/filesystem/include/ludus/foundation/filesystem/filesystem.hpp

Directory

ludus::foundation::filesystem::Directory::Directory(const Directory &)=delete
Root ownership is move-only.

Declared in modules/foundation/filesystem/include/ludus/foundation/filesystem/filesystem.hpp

operator=

Directory & ludus::foundation::filesystem::Directory::operator=(const Directory &)=delete
Root ownership is move-only.

Related types: Directory

Declared in modules/foundation/filesystem/include/ludus/foundation/filesystem/filesystem.hpp

Directory

ludus::foundation::filesystem::Directory::Directory(Directory &&other) noexcept
Transfers the pinned root, leaving other empty.

Declared in modules/foundation/filesystem/include/ludus/foundation/filesystem/filesystem.hpp

operator=

Directory & ludus::foundation::filesystem::Directory::operator=(Directory &&other) noexcept
Releases the previous root and transfers ownership; self-move preserves it.

Related types: Directory

Declared in modules/foundation/filesystem/include/ludus/foundation/filesystem/filesystem.hpp

IsOpen

bool ludus::foundation::filesystem::Directory::IsOpen() const noexcept
Returns whether a native root is pinned.

Declared in modules/foundation/filesystem/include/ludus/foundation/filesystem/filesystem.hpp

Open

Result ludus::foundation::filesystem::Directory::Open(std::string_view nativeRoot) noexcept
Opens a nonempty native root of at most MAX_ROOT_BYTES with no embedded NUL. Failure preserves the existing root. Trusted roots may have symlink ancestry.

Related types: Result

Declared in modules/foundation/filesystem/include/ludus/foundation/filesystem/filesystem.hpp

OpenRead

Result ludus::foundation::filesystem::Directory::OpenRead(std::string_view relativePath, File &output) const noexcept
Opens a validated relative path as a regular-file revision; failure preserves output. Native filename equivalence follows the host filesystem, including Windows and macOS case rules.

Related types: File · Result

Declared in modules/foundation/filesystem/include/ludus/foundation/filesystem/filesystem.hpp

Observe

Result ludus::foundation::filesystem::Directory::Observe(std::string_view relativePath, FileStamp &output) const noexcept
Observes a validated path without allocating or opening the leaf for reading. Rejects child symlinks and non-regular leaves; failure preserves output. NotFound means an ancestor or leaf was absent at observation time.

Related types: FileStamp · Result

Declared in modules/foundation/filesystem/include/ludus/foundation/filesystem/filesystem.hpp

Close

Result ludus::foundation::filesystem::Directory::Close() noexcept
Releases the root even on error; open files retain their independent lifetimes.

Related types: Result

Declared in modules/foundation/filesystem/include/ludus/foundation/filesystem/filesystem.hpp