From 6a92ee5fbc7d47998fc399efe424e451cf75657c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 5 Mar 2010 04:46:06 +0000 Subject: Shrink extensions (to .ing.lv2 and .ing.ttl) and move definitions to central place so they aren't littered everywhere. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2525 a436a847-0d15-0410-975c-d299462d15a1 --- src/gui/LoadPatchWindow.cpp | 9 +++++---- src/gui/PatchWindow.cpp | 11 ++++++----- src/gui/ThreadedLoader.cpp | 2 +- src/gui/UploadPatchWindow.cpp | 3 ++- src/ingen/main.cpp | 3 ++- src/serialisation/Parser.cpp | 10 ++++++---- src/serialisation/Serialiser.cpp | 5 +++-- 7 files changed, 25 insertions(+), 18 deletions(-) diff --git a/src/gui/LoadPatchWindow.cpp b/src/gui/LoadPatchWindow.cpp index 3a06843b..0fbc38c4 100644 --- a/src/gui/LoadPatchWindow.cpp +++ b/src/gui/LoadPatchWindow.cpp @@ -26,6 +26,7 @@ #include "client/PatchModel.hpp" #include "client/ClientStore.hpp" #include "shared/runtime_paths.hpp" +#include "serialisation/names.hpp" #include "App.hpp" #include "LoadPatchWindow.hpp" #include "PatchView.hpp" @@ -74,10 +75,10 @@ LoadPatchWindow::LoadPatchWindow(BaseObjectType* cobject, const Glib::RefPtrproperty_has_default() = true; Gtk::FileFilter filt; - filt.add_pattern("*.ingen.lv2"); + filt.add_pattern("*" INGEN_BUNDLE_EXT); filt.set_name("Ingen bundles"); dialog.set_filter(filt); @@ -446,11 +447,11 @@ PatchWindow::event_save_as() std::string basename = Glib::path_get_basename(filename); if (basename.find('.') == string::npos) { - filename += ".ingen.lv2"; - basename += ".ingen.lv2"; - } else if (filename.substr(filename.length() - 10) != ".ingen.lv2") { + filename += INGEN_BUNDLE_EXT; + basename += INGEN_BUNDLE_EXT; + } else if (filename.substr(filename.length() - 10) != INGEN_BUNDLE_EXT) { Gtk::MessageDialog error_dialog(*this, -"" "Ingen patches must be saved to Ingen bundles (*.ingen.lv2)." "", +"" "Ingen patches must be saved to Ingen bundles (*" INGEN_BUNDLE_EXT ")." "", true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); error_dialog.run(); continue; diff --git a/src/gui/ThreadedLoader.cpp b/src/gui/ThreadedLoader.cpp index 6da5bcd0..9b991555 100644 --- a/src/gui/ThreadedLoader.cpp +++ b/src/gui/ThreadedLoader.cpp @@ -137,7 +137,7 @@ ThreadedLoader::save_patch_event(SharedPtr model, const string& file { if (App::instance().serialiser()) { Serialiser::Record r(model, filename); - if (filename.find(".ingen") != string::npos) + if (filename.find(".ing.lv2") != string::npos) App::instance().serialiser()->write_bundle(r); else App::instance().serialiser()->to_file(r); diff --git a/src/gui/UploadPatchWindow.cpp b/src/gui/UploadPatchWindow.cpp index 1804ff06..3d7afe11 100644 --- a/src/gui/UploadPatchWindow.cpp +++ b/src/gui/UploadPatchWindow.cpp @@ -27,6 +27,7 @@ #include "client/ClientStore.hpp" #include "interface/EngineInterface.hpp" #include "serialisation/Serialiser.hpp" +#include "serialisation/names.hpp" #include "client/PatchModel.hpp" #include "UploadPatchWindow.hpp" #include "App.hpp" @@ -254,7 +255,7 @@ UploadPatchWindow::upload_clicked() Serialiser s(*App::instance().world(), App::instance().store()); const string uri = string("http://rdf.drobilla.net/ingen_patches/") - .append(symbol).append(".ingen.ttl"); + .append(symbol).append(INGEN_PATCH_FILE_EXT); const string str = s.to_string(_patch, uri, extra_rdf); diff --git a/src/ingen/main.cpp b/src/ingen/main.cpp index c8d0c944..cd8ad999 100644 --- a/src/ingen/main.cpp +++ b/src/ingen/main.cpp @@ -74,7 +74,8 @@ main(int argc, char** argv) " ingen -e # Run an engine, listen for OSC\n" " ingen -g # Run a GUI, connect via OSC\n" " ingen -eg # Run an engine and a GUI in one process\n" - " ingen -egl patch.ingen.ttl # Run an engine and a GUI and load a patch"); + " ingen -egl patch.ing.ttl # Run an engine and a GUI and load a patch file\n" + " ingen -egl patch.ing.lv2 # Run an engine and a GUI and load a patch bundle"); conf.add("client-port", 'C', "Client OSC port", Atom::INT, Atom()) .add("connect", 'c', "Connect to engine URI", Atom::STRING, "osc.udp://localhost:16180") diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp index 11c0efb1..9fe1d036 100644 --- a/src/serialisation/Parser.cpp +++ b/src/serialisation/Parser.cpp @@ -32,6 +32,7 @@ #include "module/World.hpp" #include "shared/LV2URIMap.hpp" #include "Parser.hpp" +#include "names.hpp" #define LOG(s) s << "[Parser] " @@ -86,12 +87,13 @@ Parser::parse_document( normalise_uri(document_uri); const std::string filename(Glib::filename_from_uri(document_uri)); - const size_t ext = filename.find(".ingen.lv2"); - if (ext == filename.length() - 10 - || (ext == filename.length() - 11 && filename[filename.length() - 1] == '/')) { + const size_t ext = filename.find(INGEN_BUNDLE_EXT); + const size_t ext_len = strlen(INGEN_BUNDLE_EXT); + if (ext == filename.length() - ext_len + || (ext == filename.length() - ext_len - 1 && filename[filename.length() - 1] == '/')) { std::string basename(Glib::path_get_basename(filename)); basename = basename.substr(0, basename.find('.')); - document_uri += "/" + basename + ".ingen.ttl"; + document_uri += "/" + basename + INGEN_PATCH_FILE_EXT; } Redland::Model model(*world->rdf_world, document_uri, document_uri); diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp index 8d88a21c..735f9788 100644 --- a/src/serialisation/Serialiser.cpp +++ b/src/serialisation/Serialiser.cpp @@ -47,6 +47,7 @@ #include "shared/ResourceImpl.hpp" #include "shared/LV2URIMap.hpp" #include "Serialiser.hpp" +#include "names.hpp" #define LOG(s) s << "[Serialiser] " @@ -132,11 +133,11 @@ Serialiser::write_bundle(const Record& record) string symbol = uri_to_symbol(record.uri); - const string root_file = bundle_uri + symbol + ".ingen.ttl"; + const string root_file = bundle_uri + symbol + INGEN_PATCH_FILE_EXT; start_to_filename(root_file); serialise(object); finish(); - records.push_back(Record(object, bundle_uri + symbol + ".ingen.ttl")); + records.push_back(Record(object, bundle_uri + symbol + INGEN_PATCH_FILE_EXT)); write_manifest(bundle_uri, records); } -- cgit v1.2.1