summaryrefslogtreecommitdiffstats
path: root/src/serialisation
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-03-05 04:46:06 +0000
committerDavid Robillard <d@drobilla.net>2010-03-05 04:46:06 +0000
commit6a92ee5fbc7d47998fc399efe424e451cf75657c (patch)
tree108e144fbb142f6592f20e3c08ff7f22eeef7016 /src/serialisation
parent78eb8c2b49a7858ace15adcfbb59505cb6a2cb71 (diff)
downloadingen-6a92ee5fbc7d47998fc399efe424e451cf75657c.tar.gz
ingen-6a92ee5fbc7d47998fc399efe424e451cf75657c.tar.bz2
ingen-6a92ee5fbc7d47998fc399efe424e451cf75657c.zip
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
Diffstat (limited to 'src/serialisation')
-rw-r--r--src/serialisation/Parser.cpp10
-rw-r--r--src/serialisation/Serialiser.cpp5
2 files changed, 9 insertions, 6 deletions
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);
}