|
wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
|
A local directory acting as the ultimate patch: files here override every client archive, and new files are added here. More...
#include <wowlib/fs/project_directory.hpp>
Public Member Functions | |
| ProjectDirectory ()=default | |
| std::optional< std::filesystem::path > | resolve (std::string_view path) const |
| The real on-disk location of a client-internal path, if the overlay carries it. | |
| bool | exists (std::string_view path) const |
| Whether the overlay carries a file. | |
| Result< FileBuffer > | read (std::string_view path) const |
| Read an overlay file into memory. | |
| Result< void > | write (std::string_view path, std::span< const std::byte > content) |
| Write (create or overwrite) a file under the overlay, creating intermediate directories, and index it. | |
| void | rescan () |
| Rebuild the index from disk, picking up files changed by other tools. | |
| const std::filesystem::path & | root () const |
| std::size_t | size () const |
| ProjectDirectory (const ProjectDirectory &)=delete | |
| ProjectDirectory & | operator= (const ProjectDirectory &)=delete |
| ProjectDirectory (ProjectDirectory &&other) noexcept | |
| ProjectDirectory & | operator= (ProjectDirectory &&other) noexcept |
Static Public Member Functions | |
| static Result< ProjectDirectory > | open (std::filesystem::path root) |
| Open (and index) a project directory; it is created if missing. | |
A local directory acting as the ultimate patch: files here override every client archive, and new files are added here.
Lookups go through an in-memory index keyed by canonical path, so they are case-insensitive regardless of the disk's filesystem and O(1). Not welded — target languages reach it through the FileSystem facade.
Definition at line 25 of file project_directory.hpp.
|
default |
References root().
Referenced by open(), operator=(), operator=(), ProjectDirectory(), and ProjectDirectory().
|
delete |
References ProjectDirectory().
|
noexcept |
Definition at line 14 of file project_directory.cpp.
References ProjectDirectory().
| bool wowlib::fs::ProjectDirectory::exists | ( | std::string_view | path | ) | const |
Whether the overlay carries a file.
| path | the client-internal file path. |
Definition at line 73 of file project_directory.cpp.
References resolve().
|
static |
Open (and index) a project directory; it is created if missing.
| root | the directory root. |
Definition at line 29 of file project_directory.cpp.
References wowlib::IoError, wowlib::makeError(), ProjectDirectory(), and root().
Referenced by wowlib::fs::FileSystem::open().
|
delete |
References ProjectDirectory().
|
noexcept |
Definition at line 20 of file project_directory.cpp.
References ProjectDirectory().
| Result< FileBuffer > wowlib::fs::ProjectDirectory::read | ( | std::string_view | path | ) | const |
Read an overlay file into memory.
| path | the client-internal file path. |
Definition at line 77 of file project_directory.cpp.
References wowlib::FileNotFound, wowlib::IoError, wowlib::makeError(), wowlib::normalizePath(), and resolve().
| void wowlib::fs::ProjectDirectory::rescan | ( | ) |
Rebuild the index from disk, picking up files changed by other tools.
Definition at line 61 of file project_directory.cpp.
| std::optional< std::filesystem::path > wowlib::fs::ProjectDirectory::resolve | ( | std::string_view | path | ) | const |
The real on-disk location of a client-internal path, if the overlay carries it.
| path | the client-internal file path. |
Definition at line 66 of file project_directory.cpp.
References wowlib::normalizePath().
|
inline |
Definition at line 61 of file project_directory.hpp.
Referenced by open(), and ProjectDirectory().
| std::size_t wowlib::fs::ProjectDirectory::size | ( | ) | const |
Definition at line 122 of file project_directory.cpp.
| Result< void > wowlib::fs::ProjectDirectory::write | ( | std::string_view | path, |
| std::span< const std::byte > | content ) |
Write (create or overwrite) a file under the overlay, creating intermediate directories, and index it.
| path | the client-internal file path. |
| content | the file contents. |
Definition at line 96 of file project_directory.cpp.
References wowlib::InvalidPath, wowlib::IoError, wowlib::makeError(), wowlib::normalizePath(), and wowlib::toNativeRelative().