Directory.h 1003 B

123456789101112131415161718192021222324252627
  1. #pragma once
  2. #include <filesystem>
  3. #include <utility>
  4. #include "Types.h"
  5. namespace WallpaperEngine::FileSystem::Adapters {
  6. struct DirectoryFactory final : Factory {
  7. DirectoryFactory () = default;
  8. [[nodiscard]] bool handlesMountpoint (const std::filesystem::path& path) const override;
  9. [[nodiscard]] AdapterSharedPtr create (const std::filesystem::path& path) const override;
  10. };
  11. struct DirectoryAdapter final : Adapter {
  12. explicit DirectoryAdapter (std::filesystem::path path) : basepath (std::move (path)) { }
  13. [[nodiscard]] ReadStreamSharedPtr open (const std::filesystem::path& path) const override;
  14. [[nodiscard]] bool exists (const std::filesystem::path& path) const override;
  15. [[nodiscard]] std::filesystem::path physicalPath (const std::filesystem::path& path) const override;
  16. [[nodiscard]] std::optional<std::filesystem::path>
  17. resolveWorkshopDependencyAlias (const std::filesystem::path& path) const override;
  18. const std::filesystem::path basepath;
  19. };
  20. }