combiner.md
This commit is contained in:
@@ -38,7 +38,9 @@ struct NodeProcess {
|
||||
class StudioManager {
|
||||
public:
|
||||
StudioManager(fs::path bin_dir, std::string domain)
|
||||
: bin_dir_(std::move(bin_dir)), domain_(std::move(domain)) {}
|
||||
: bin_dir_(std::move(bin_dir))
|
||||
, domain_(std::move(domain))
|
||||
, save_path_(bin_dir_ / "last_graph.json") {}
|
||||
|
||||
~StudioManager() { shutdown(); }
|
||||
|
||||
@@ -53,6 +55,7 @@ public:
|
||||
garbage_collect_locked();
|
||||
try {
|
||||
graph_ = parse_graph(graph_json);
|
||||
save_graph_locked(graph_json);
|
||||
start_all_locked();
|
||||
} catch (const std::exception& e) {
|
||||
err = e.what();
|
||||
@@ -140,6 +143,7 @@ public:
|
||||
private:
|
||||
fs::path bin_dir_;
|
||||
std::string domain_;
|
||||
fs::path save_path_;
|
||||
FlowGraph graph_;
|
||||
std::vector<NodeProcess> processes_;
|
||||
std::mutex mutex_;
|
||||
@@ -235,6 +239,13 @@ private:
|
||||
if (changed) notify(s);
|
||||
}
|
||||
|
||||
void save_graph_locked(const nlohmann::json& j) {
|
||||
std::ofstream f(save_path_);
|
||||
if (f) f << j.dump(2);
|
||||
else fprintf(stderr, "[studio-manager] warning: could not save graph to %s\n",
|
||||
save_path_.c_str());
|
||||
}
|
||||
|
||||
// ── static helpers ───────────────────────────────────────────────────────
|
||||
|
||||
static FlowGraph parse_graph(const nlohmann::json& j) {
|
||||
|
||||
Reference in New Issue
Block a user