aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/engine/Machine.cpp8
-rw-r--r--src/gui/MachinaGUI.cpp23
2 files changed, 15 insertions, 16 deletions
diff --git a/src/engine/Machine.cpp b/src/engine/Machine.cpp
index 09e0e72..0ddf61c 100644
--- a/src/engine/Machine.cpp
+++ b/src/engine/Machine.cpp
@@ -305,7 +305,7 @@ Machine::write_state(Raul::RDF::Model& model)
model.world().add_prefix("machina", "http://drobilla.net/ns/machina#");
- model.add_statement(RDF::Node(model.world(), RDF::Node::RESOURCE, ""),
+ model.add_statement(model.base_uri(),
RDF::Node(model.world(), RDF::Node::RESOURCE, "rdf:type"),
RDF::Node(model.world(), RDF::Node::RESOURCE, "machina:Machine"));
@@ -316,11 +316,11 @@ Machine::write_state(Raul::RDF::Model& model)
(*n)->write_state(model);
if ((*n)->is_initial()) {
- model.add_statement(RDF::Node(model.world(), RDF::Node::RESOURCE, ""),
+ model.add_statement(model.base_uri(),
RDF::Node(model.world(), RDF::Node::RESOURCE, "machina:initialNode"),
(*n)->id());
} else {
- model.add_statement(RDF::Node(model.world(), RDF::Node::RESOURCE, ""),
+ model.add_statement(model.base_uri(),
RDF::Node(model.world(), RDF::Node::RESOURCE, "machina:node"),
(*n)->id());
}
@@ -335,7 +335,7 @@ Machine::write_state(Raul::RDF::Model& model)
(*e)->write_state(model);
- model.add_statement(RDF::Node(model.world(), RDF::Node::RESOURCE, ""),
+ model.add_statement(model.base_uri(),
RDF::Node(model.world(), RDF::Node::RESOURCE, "machina:edge"),
(*e)->id());
}
diff --git a/src/gui/MachinaGUI.cpp b/src/gui/MachinaGUI.cpp
index 39dd098..8472d5f 100644
--- a/src/gui/MachinaGUI.cpp
+++ b/src/gui/MachinaGUI.cpp
@@ -267,17 +267,13 @@ MachinaGUI::menu_file_save()
if (_save_uri == "" || _save_uri.substr(0, 5) != "file:") {
menu_file_save_as();
} else {
- char* save_filename = raptor_uri_uri_string_to_filename(
- (const unsigned char*)_save_uri.c_str());
- if (!save_filename) {
- cerr << "ERROR: Unable to create filename from \"" << _save_uri << "\"" << endl;
+ if (!raptor_uri_uri_string_is_file_uri((const unsigned char*)_save_uri.c_str()))
menu_file_save_as();
- }
+
Raul::RDF::Model model(_engine->rdf_world());
- cout << "Writing machine to " << save_filename << endl;
+ model.set_base_uri(_save_uri);
machine()->write_state(model);
- model.serialise_to_file(save_filename);
- free(save_filename);
+ model.serialise_to_file(_save_uri);
}
}
@@ -303,8 +299,10 @@ MachinaGUI::menu_file_save_as()
if (result == Gtk::RESPONSE_OK) {
string filename = dialog.get_filename();
- if (filename.length() < 8 || filename.substr(filename.length()-8) != ".machina")
- filename += ".machina";
+ if (filename.length() < 13 || filename.substr(filename.length()-12) != ".machina.ttl")
+ filename += ".machina.ttl";
+
+ Glib::ustring uri = Glib::filename_to_uri(filename);
bool confirm = false;
std::fstream fin;
@@ -325,9 +323,10 @@ MachinaGUI::menu_file_save_as()
if (confirm) {
Raul::RDF::Model model(_engine->rdf_world());
+ _save_uri = uri;
+ model.set_base_uri(_save_uri);
_engine->machine()->write_state(model);
- model.serialise_to_file(filename);
- _save_uri = dialog.get_uri();
+ model.serialise_to_file(_save_uri);
}
}
}