Skip to content

ludus::foundation::filesystem::File

Ludus Wiki · API overview · Browse API

Class

Owns an opened regular-file revision on Windows, Linux, macOS or Emscripten MEMFS. Other targets return Unsupported. Browser reads address session memory, not host files. Concurrent const operations require disjoint destinations and stable owner lifetime. Closing, moving and replacing an owner require exclusive access.

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

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

Methods

File

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

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

~File

ludus::foundation::filesystem::File::~File() noexcept
Closes best-effort without logging or propagating errors.

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

File

ludus::foundation::filesystem::File::File(const File &)=delete
Ownership is move-only; use Clone to duplicate an opened revision.

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

operator=

File & ludus::foundation::filesystem::File::operator=(const File &)=delete
Ownership is move-only; use Clone to duplicate an opened revision.

Related types: File

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

File

ludus::foundation::filesystem::File::File(File &&other) noexcept
Transfers ownership, leaving other empty.

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

operator=

File & ludus::foundation::filesystem::File::operator=(File &&other) noexcept
Closes the previous revision and transfers ownership; self-move preserves it.

Related types: File

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

IsOpen

bool ludus::foundation::filesystem::File::IsOpen() const noexcept
Returns whether this owner contains an opened revision.

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

Size

uint64 ludus::foundation::filesystem::File::Size() const noexcept
Returns the captured byte length, or zero for an empty owner.

Related types: uint64

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

Clone

Result ludus::foundation::filesystem::File::Clone(File &output) const noexcept
Duplicates the opened revision without pathname lookup; failure preserves output. A closed source returns InvalidArgument. Output may alias this owner.

Related types: File · Result

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

ReadAt

ReadResult ludus::foundation::filesystem::File::ReadAt(uint64 offset, std::span< uint8 > destination) const noexcept
Fills destination up to captured EOF; offsets above Size() return InvalidArgument. Handles interrupted/short reads. Size/mtime checks run before and after even empty reads. Changed means BytesRead is zero and the touched buffer must be discarded; other failures report partial progress. Metadata detection provides no snapshot guarantee.

Related types: uint64 · uint8 · ReadResult

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

Close

Result ludus::foundation::filesystem::File::Close() noexcept
Releases ownership even on native error; repeated calls succeed. Never retries close.

Related types: Result

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