diff options
author | Robin Gareus <robin@gareus.org> | 2018-07-10 00:57:04 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2018-07-10 00:58:18 +0200 |
commit | 333f59a53f2ba62d751bf8cc767e79d4af980aee (patch) | |
tree | 3ae8d5737fd3d0e1b386448a30d1cc3b0cb79cd4 /libs/ardour/lv2_plugin.cc | |
parent | 59029765e8d8a02b7759124dcb004a9a285cee97 (diff) |
Fix lv2-state templates with external files.
This forces liblilv to collect external files in the template-folder
and symlink to the original file instead of re-using the external-file
folder of the session that was used to create the template.
Diffstat (limited to 'libs/ardour/lv2_plugin.cc')
-rw-r--r-- | libs/ardour/lv2_plugin.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc index 1fd54c6286..6f8dad9396 100644 --- a/libs/ardour/lv2_plugin.cc +++ b/libs/ardour/lv2_plugin.cc @@ -51,6 +51,7 @@ #include "ardour/audio_buffer.h" #include "ardour/audioengine.h" +#include "ardour/directory_names.h" #include "ardour/debug.h" #include "ardour/lv2_plugin.h" #include "ardour/midi_patch_manager.h" @@ -1380,13 +1381,20 @@ LV2Plugin::add_state(XMLNode* root) const unsigned int saved_state = _state_version;; g_mkdir_with_parents(new_dir.c_str(), 0744); + std::string xternal_dir = _session.externals_dir (); + + if (!_plugin_state_dir.empty()) { + xternal_dir = Glib::build_filename (_plugin_state_dir, externals_dir_name); + g_mkdir_with_parents(xternal_dir.c_str(), 0744); + } + LilvState* state = lilv_state_new_from_instance( _impl->plugin, _impl->instance, _uri_map.urid_map(), scratch_dir().c_str(), file_dir().c_str(), - _session.externals_dir().c_str(), + xternal_dir.c_str(), new_dir.c_str(), NULL, const_cast<LV2Plugin*>(this), @@ -1416,6 +1424,7 @@ LV2Plugin::add_state(XMLNode* root) const } else { // template save (dedicated state-dir) lilv_state_free(state); + g_rmdir (xternal_dir.c_str()); // try remove unused dir --_state_version; } } else { |