// SPDX-License-Identifier: GPL-3.0-only #pragma once #include "modern/ui/demo_files.hpp" #include namespace bmh::modern_ui { // Real OBS files only. Entry.data is validated display metadata, never a DemoSource checkpoint. class CareerFiles { public: using Reader=std::function; using Writer=std::function; CareerFiles(fs::path directory,Reader reader); static std::string clean_name(const std::string&); std::vector list() const; DemoFileEntry read(const std::string&,const std::string& expected={}) const; std::string free_name(const std::string&) const; DemoFileEntry put(const std::string& name,const Writer&,const std::string& id={},const std::string& expected={}); DemoFileEntry rename(const std::string&,const std::string&,const std::string&); void remove(const std::string&,const std::string&); DemoFileEntry import_file(const fs::path&); void export_file(const std::string&,const std::string&,const fs::path&,bool overwrite=false) const; fs::path file(const std::string&) const; fs::path directory() const {return directory_;} private: fs::path directory_;Reader reader_; DemoFileEntry decode(const fs::path&) const; void available_name(const std::string&,const std::string& except={}) const; }; // Production metadata reader, implemented with the Modern content adapter. CareerFiles make_career_files(const fs::path &directory,const fs::path &world); } // namespace bmh::modern_ui