18 static constexpr std::string_view assets_alias =
"assets";
19 static constexpr std::string_view shared_alias =
"shared";
23 std::string workspace =
"pixelbullet";
24 std::filesystem::path asset_base_path;
25 std::filesystem::path workspace_root;
26 std::filesystem::path packaged_runtime_root;
29 explicit Filesystem(std::unique_ptr<bazel::tools::cpp::runfiles::Runfiles> runfiles);
30 explicit Filesystem(std::unique_ptr<bazel::tools::cpp::runfiles::Runfiles> runfiles,
Config config);
38 [[nodiscard]] std::optional<std::filesystem::path> TryResolve(
const VirtualPath& path)
const;
39 [[nodiscard]] std::filesystem::path Resolve(
const VirtualPath& path)
const;
40 [[nodiscard]] std::filesystem::path ResolveWritable(
const VirtualPath& path)
const;
41 [[nodiscard]]
bool Exists(
const VirtualPath& path)
const;
43 [[nodiscard]]
const std::filesystem::path& GetAssetBasePath() const noexcept
45 return asset_base_path_;
48 [[nodiscard]]
const std::filesystem::path& GetWorkspaceRoot() const noexcept
50 return workspace_root_;
53 [[nodiscard]]
const std::filesystem::path& GetPackagedRuntimeRoot() const noexcept
55 return packaged_runtime_root_;
59 enum class VirtualRoot
68 std::filesystem::path path;
69 VirtualRoot root = VirtualRoot::Direct;
72 [[nodiscard]] std::optional<ExpandedPath> ExpandPath(
const VirtualPath& path)
const;
73 [[nodiscard]] std::filesystem::path BuildRuntimeRelativePath(
const std::filesystem::path& logicalPath, VirtualRoot root)
const;
74 [[nodiscard]] std::filesystem::path BuildRunfilesLookup(
const std::filesystem::path& logicalPath, VirtualRoot root)
const;
75 [[nodiscard]] std::filesystem::path BuildPackagedLookup(
const std::filesystem::path& logicalPath, VirtualRoot root)
const;
76 [[nodiscard]]
static std::filesystem::path DetectWorkspaceRoot(
const std::filesystem::path& startPath);
79 std::unique_ptr<bazel::tools::cpp::runfiles::Runfiles> runfiles_;
80 std::string workspace_name_;
81 std::filesystem::path asset_base_path_;
82 std::filesystem::path workspace_root_;
83 std::filesystem::path packaged_runtime_root_;