21 static constexpr std::string_view assets_alias =
"assets";
22 static constexpr std::string_view shared_alias =
"shared";
26 std::string workspace =
"pixelbullet";
27 std::filesystem::path asset_base_path;
28 std::filesystem::path workspace_root;
29 std::filesystem::path packaged_runtime_root;
33 explicit Filesystem(
Config config);
34 ~Filesystem() =
default;
36 Filesystem(
const Filesystem&) =
delete;
37 Filesystem& operator=(
const Filesystem&) =
delete;
38 Filesystem(Filesystem&&) =
delete;
39 Filesystem& operator=(Filesystem&&) =
delete;
41 [[nodiscard]] std::optional<std::filesystem::path> try_resolve(
const VirtualPath& path)
const;
42 [[nodiscard]] std::filesystem::path resolve(
const VirtualPath& path)
const;
43 [[nodiscard]] std::filesystem::path resolve_writable(
const VirtualPath& path)
const;
44 [[nodiscard]]
bool exists(
const VirtualPath& path)
const;
46 [[nodiscard]]
const std::filesystem::path& asset_base_path() const noexcept
48 return asset_base_path_;
51 [[nodiscard]]
const std::filesystem::path& workspace_root() const noexcept
53 return workspace_root_;
56 [[nodiscard]]
const std::filesystem::path& packaged_runtime_root() const noexcept
58 return packaged_runtime_root_;
62 using RuntimeLookup = std::function<std::optional<std::filesystem::path>(
const std::filesystem::path&)>;
63 friend class filesystem_internal::FilesystemRuntimeAccess;
65 explicit Filesystem(
Config config, RuntimeLookup runtime_lookup);
67 enum class VirtualRoot
76 std::filesystem::path path;
77 VirtualRoot root = VirtualRoot::Direct;
80 [[nodiscard]] std::optional<ExpandedPath> expand_path(
const VirtualPath& path)
const;
81 [[nodiscard]] std::filesystem::path build_runtime_relative_path(
const std::filesystem::path& logical_path, VirtualRoot root)
const;
82 [[nodiscard]] std::filesystem::path build_runtime_lookup_path(
const std::filesystem::path& logical_path, VirtualRoot root)
const;
83 [[nodiscard]] std::filesystem::path build_packaged_lookup(
const std::filesystem::path& logical_path, VirtualRoot root)
const;
84 [[nodiscard]]
static std::filesystem::path detect_workspace_root(
const std::filesystem::path& start_path);
87 RuntimeLookup runtime_lookup_;
88 std::string workspace_name_;
89 std::filesystem::path asset_base_path_;
90 std::filesystem::path workspace_root_;
91 std::filesystem::path packaged_runtime_root_;