From 50a6edb088ead6d8f6287aeca55e4d704add61a2 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 29 Jul 2016 19:41:19 -0400 Subject: Save bundled graphs to graph.ttl by default This avoids a lot of hassle with filename construction and renaming, while ensuring that the internal structure of any graph bundle is the same. --- src/Parser.cpp | 5 ++--- src/Serialiser.cpp | 17 ++++++----------- tests/empty.ingen/empty.ttl | 41 ----------------------------------------- tests/empty.ingen/graph.ttl | 41 +++++++++++++++++++++++++++++++++++++++++ tests/empty.ingen/manifest.ttl | 4 ++-- 5 files changed, 51 insertions(+), 57 deletions(-) delete mode 100644 tests/empty.ingen/empty.ttl create mode 100644 tests/empty.ingen/graph.ttl diff --git a/src/Parser.cpp b/src/Parser.cpp index 50ccb975..31ab4245 100644 --- a/src/Parser.cpp +++ b/src/Parser.cpp @@ -1,6 +1,6 @@ /* This file is part of Ingen. - Copyright 2007-2015 David Robillard + Copyright 2007-2016 David Robillard Ingen is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free @@ -312,8 +312,7 @@ parse_block(Ingen::World* world, &ignored); const std::string sub_uri_str = (const char*)sub_uri.buf; - const std::string basename = get_basename(sub_uri_str); - const std::string sub_file = sub_uri_str + '/' + basename + ".ttl"; + const std::string sub_file = sub_uri_str + "/graph.ttl"; const SerdNode sub_base = serd_node_from_string( SERD_URI, (const uint8_t*)sub_file.c_str()); diff --git a/src/Serialiser.cpp b/src/Serialiser.cpp index bb185e9a..ea090f8c 100644 --- a/src/Serialiser.cpp +++ b/src/Serialiser.cpp @@ -1,6 +1,6 @@ /* This file is part of Ingen. - Copyright 2007-2015 David Robillard + Copyright 2007-2016 David Robillard Ingen is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free @@ -90,8 +90,7 @@ struct Serialiser::Impl { Sord::Node path_rdf_node(const Raul::Path& path); void write_manifest(const std::string& bundle_path, - SPtr graph, - const std::string& graph_symbol); + SPtr graph); void write_plugins(const std::string& bundle_path, const std::set plugins); @@ -121,8 +120,7 @@ Serialiser::~Serialiser() void Serialiser::Impl::write_manifest(const std::string& bundle_path, - SPtr graph, - const std::string& graph_symbol) + SPtr graph) { const string manifest_path(Glib::build_filename(bundle_path, "manifest.ttl")); const string binary_path(Glib::Module::build_path("", "ingen_lv2")); @@ -132,7 +130,7 @@ Serialiser::Impl::write_manifest(const std::string& bundle_path, Sord::World& world = _model->world(); const URIs& uris = _world.uris(); - const string filename(graph_symbol + ".ttl"); + const string filename("graph.ttl"); const Sord::URI subject(world, filename, _base_uri); _model->add_statement(subject, @@ -207,10 +205,7 @@ Serialiser::Impl::write_bundle(SPtr graph, g_mkdir_with_parents(path.c_str(), 0744); - string symbol = Glib::path_get_basename(path); - symbol = symbol.substr(0, symbol.find(".")); - - const string root_file = Glib::build_filename(path, symbol + ".ttl"); + const string root_file = Glib::build_filename(path, "graph.ttl"); start_to_filename(root_file); const Raul::Path old_root_path = _root_path; @@ -222,7 +217,7 @@ Serialiser::Impl::write_bundle(SPtr graph, _root_path = old_root_path; finish(); - write_manifest(path, graph, symbol); + write_manifest(path, graph); write_plugins(path, plugins); } diff --git a/tests/empty.ingen/empty.ttl b/tests/empty.ingen/empty.ttl deleted file mode 100644 index aaaf6087..00000000 --- a/tests/empty.ingen/empty.ttl +++ /dev/null @@ -1,41 +0,0 @@ -@prefix rdf: . -@prefix atom: . -@prefix patch: . -@prefix doap: . -@prefix ingen: . -@prefix lv2: . -@prefix lv2ev: . -@prefix midi: . -@prefix owl: . -@prefix rdfs: . -@prefix xsd: . - - - ingen:polyphonic false ; - atom:bufferType atom:Sequence ; - lv2:index 0 ; - lv2:name "Control" ; - lv2:portProperty lv2:connectionOptional ; - lv2:symbol "control_in" ; - a atom:AtomPort , - lv2:InputPort . - - - ingen:polyphonic false ; - atom:bufferType atom:Sequence ; - lv2:index 1 ; - lv2:name "Control" ; - lv2:symbol "control_out" ; - a atom:AtomPort , - lv2:OutputPort . - -<> - ingen:polyphony 1 ; - ingen:GraphUIGtk2 ; - lv2:extensionData ; - lv2:port , - ; - lv2:symbol "empty" ; - doap:name "empty" ; - a ingen:Graph , - lv2:Plugin . diff --git a/tests/empty.ingen/graph.ttl b/tests/empty.ingen/graph.ttl new file mode 100644 index 00000000..aaaf6087 --- /dev/null +++ b/tests/empty.ingen/graph.ttl @@ -0,0 +1,41 @@ +@prefix rdf: . +@prefix atom: . +@prefix patch: . +@prefix doap: . +@prefix ingen: . +@prefix lv2: . +@prefix lv2ev: . +@prefix midi: . +@prefix owl: . +@prefix rdfs: . +@prefix xsd: . + + + ingen:polyphonic false ; + atom:bufferType atom:Sequence ; + lv2:index 0 ; + lv2:name "Control" ; + lv2:portProperty lv2:connectionOptional ; + lv2:symbol "control_in" ; + a atom:AtomPort , + lv2:InputPort . + + + ingen:polyphonic false ; + atom:bufferType atom:Sequence ; + lv2:index 1 ; + lv2:name "Control" ; + lv2:symbol "control_out" ; + a atom:AtomPort , + lv2:OutputPort . + +<> + ingen:polyphony 1 ; + ingen:GraphUIGtk2 ; + lv2:extensionData ; + lv2:port , + ; + lv2:symbol "empty" ; + doap:name "empty" ; + a ingen:Graph , + lv2:Plugin . diff --git a/tests/empty.ingen/manifest.ttl b/tests/empty.ingen/manifest.ttl index 0bd4224e..c02191ef 100644 --- a/tests/empty.ingen/manifest.ttl +++ b/tests/empty.ingen/manifest.ttl @@ -9,8 +9,8 @@ @prefix rdfs: . @prefix xsd: . - + lv2:prototype ingen:GraphPrototype ; a ingen:Graph , lv2:Plugin ; - rdfs:seeAlso . + rdfs:seeAlso . -- cgit v1.2.1