_path += '/';
}
+ if (Glib::file_test (_path, Glib::FILE_TEST_EXISTS) && ::access (_path.c_str(), W_OK)) {
+ cerr << "Session non-writable based on " << _path << endl;
+ _writable = false;
+ } else {
+ cerr << "Session writable based on " << _path << endl;
+ _writable = true;
+ }
+
set_history_depth (Config->get_history_depth());
_tempo_map->StateChanged.connect (mem_fun (*this, &Session::tempo_map_changed));
g_atomic_int_set (&processing_prohibited, 0);
+ post_transport_work = PostTransportWork (0);
insert_cnt = 0;
_transport_speed = 0;
_last_transport_speed = 0;
current_block_size = 0;
solo_update_disabled = false;
currently_soloing = false;
+ _was_seamless = Config->get_seamless_loop ();
_have_captured = false;
_worst_output_latency = 0;
_worst_input_latency = 0;
_worst_track_latency = 0;
_state_of_the_state = StateOfTheState(CannotSave|InitialConnecting|Loading);
-
+
_slave = 0;
_silent = false;
session_send_mmc = false;
_pan_automation_buffer = 0;
_npan_buffers = 0;
pending_abort = false;
+ pending_clear_substate = false;
destructive_index = 0;
current_trans = 0;
first_file_data_format_reset = true;
string xml_path;
string bak_path;
- if (_state_of_the_state & CannotSave) {
+ if (!_writable || (_state_of_the_state & CannotSave)) {
return 1;
}
set_dirty();
+ /* writable() really reflects the whole folder, but if for any
+ reason the session state file can't be written to, still
+ make us unwritable.
+ */
+
+ if (::access (xmlpath.c_str(), W_OK) != 0) {
+ _writable = false;
+ }
+
if (!state_tree->read (xmlpath)) {
error << string_compose(_("Could not understand ardour file %1"), xmlpath) << endmsg;
delete state_tree;
if ((child = find_named_node (node, "end-marker-is-free")) != 0) {
if ((prop = child->property ("val")) != 0) {
- _end_location_is_free = (prop->value() == "yes");
+ _end_location_is_free = string_is_affirmative (prop->value());
}
}
if ((prop = node.property (X_("sample-rate"))) != 0) {
_nominal_frame_rate = atoi (prop->value());
-
+
if (_nominal_frame_rate != _current_frame_rate) {
if (AskAboutSampleRateMismatch (_nominal_frame_rate, _current_frame_rate)) {
- return -1;
+ throw SRMismatchRejected();
}
}
}
template_names.push_back (rti);
}
- free (templates);
+ delete templates;
}
int
void
Session::add_instant_xml (XMLNode& node, const std::string& dir)
{
- Stateful::add_instant_xml (node, dir);
+ if (_writable) {
+ Stateful::add_instant_xml (node, dir);
+ }
Config->add_instant_xml (node, get_user_ardour_path());
}
string xml_path;
string bak_path;
+ if (!_writable) {
+ return 0;
+ }
+
if (snapshot_name.empty()) {
snapshot_name = _current_snapshot_name;
}
/* read xml */
xmlpath = _path + snapshot_name + ".history";
- cerr << string_compose(_("Loading history from '%1'."), xmlpath) << endmsg;
+ info << string_compose(_("Loading history from '%1'."), xmlpath) << endmsg;
if (!Glib::file_test (xmlpath, Glib::FILE_TEST_EXISTS)) {
return 1;