2#ifndef LIBSBX_FILESYSTEM_FILESYSTEM_MODULE_HPP_
3#define LIBSBX_FILESYSTEM_FILESYSTEM_MODULE_HPP_
10#include <libsbx/core/module.hpp>
11#include <libsbx/core/engine.hpp>
13#include <libsbx/filesystem/alias.hpp>
14#include <libsbx/filesystem/virtual_filesystem.hpp>
15#include <libsbx/filesystem/filesystem_base.hpp>
16#include <libsbx/filesystem/file_base.hpp>
18namespace sbx::filesystem {
21 inline static const auto is_registered = register_module(stage::pre);
29 auto update() ->
void override;
31 template<
typename Type,
typename... Args>
32 requires (std::is_base_of_v<filesystem_base, Type>)
33 auto create_filesystem(
const alias&
alias, Args&&... args) -> std::shared_ptr<Type> {
34 return _filesystem->create_filesystem<Type>(
alias, std::forward<Args>(args)...);
37 template<
typename Type,
typename... Args>
38 auto create_filesystem(std::string&&
alias, Args&&... args) -> std::shared_ptr<Type> {
39 return _filesystem->create_filesystem<Type>(std::move(
alias), std::forward<Args>(args)...);
42 auto open_file(
const std::string& path,
const file_base::mode mode) -> file_ptr {
43 return _filesystem->open_file(path, mode);
46 auto create_file(
const std::string& path) -> file_ptr {
47 return _filesystem->create_file(path);
50 auto exists(
const std::string& path)
const ->
bool {
51 return _filesystem->exists(path);
54 auto all_files()
const -> std::vector<std::string> {
55 return _filesystem->all_files();
58 auto unregister_alias(
const alias&
alias) ->
void {
59 _filesystem->unregister_alias(
alias);
62 auto is_alias_registered(
const alias&
alias)
const ->
bool {
63 return _filesystem->is_alias_registered(
alias);
66 auto native_path_of(
const std::string& virtual_path)
const -> std::filesystem::path {
67 return _filesystem->native_path_of(virtual_path);
70 auto native_path_of(
const std::filesystem::path& virtual_path)
const -> std::filesystem::path {
71 return _filesystem->native_path_of(virtual_path);
76 std::unique_ptr<virtual_filesystem> _filesystem;
Definition: module.hpp:92
Definition: filesystem_module.hpp:20