Manage real OBS careers in native save and load dialogs (by Codex)

This commit is contained in:
Codex committed 2026-10-29 02:57:32 +01:00
1 parent 693744a961
commit e3ea03a05d
25 files changed
+539 -39

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: GPL-3.0-only
#pragma once
#include "modern/ui/demo_files.hpp"
#include <functional>
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<Json(const fs::path&)>;
using Writer=std::function<void(const fs::path&)>;
CareerFiles(fs::path directory,Reader reader);
static std::string clean_name(const std::string&);
std::vector<DemoFileEntry> 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