summaryrefslogtreecommitdiff
path: root/libs/ardour/lv2_plugin.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-08-11 16:54:39 +0200
committerRobin Gareus <robin@gareus.org>2017-08-11 16:54:39 +0200
commit89475b2c952f26db5aa77df592078656462a43c2 (patch)
tree2283d8ccb811da3b05b4ff67ae90c5545d824c1a /libs/ardour/lv2_plugin.cc
parentf27e53f48543f364bd37764018b4710b465f0369 (diff)
Fix LV2 Preset path for window
Diffstat (limited to 'libs/ardour/lv2_plugin.cc')
-rw-r--r--libs/ardour/lv2_plugin.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc
index 9456ba3d0c..e556886c34 100644
--- a/libs/ardour/lv2_plugin.cc
+++ b/libs/ardour/lv2_plugin.cc
@@ -1503,9 +1503,29 @@ LV2Plugin::do_save_preset(string name)
const string prefix = legalize_for_uri(lilv_node_as_string(plug_name));
const string base_name = legalize_for_uri(name);
const string file_name = base_name + ".ttl";
+#ifdef PLATFORM_WINDOWS
+ /* http://lv2plug.in/pages/filesystem-hierarchy-standard.html */
+ std::string appdata = PBD::get_win_special_folder_path (CSIDL_APPDATA);
+ if (appdata.empty ()) {
+ // TODO consider a fallback location
+ return "";
+ }
+ const string bundle = Glib::build_filename (
+ appdata, "LV2",
+ Glib::build_filename(prefix + "_" + base_name + ".lv2"));
+#else
+ /* while macOS/OSX user-specific path is
+ *
+ * $HOME/Library/Audio/Plug-Ins/LV2/
+ *
+ * liblilv's LV2 search path on all unices does include ~/.lv2/
+ * Ardour has been saving lv2 presets to ~/.lv2 for along time,
+ * so just keep them there.
+ */
const string bundle = Glib::build_filename(
Glib::get_home_dir(),
Glib::build_filename(".lv2", prefix + "_" + base_name + ".lv2"));
+#endif
#ifdef HAVE_LILV_0_21_3
/* delete reference to old preset (if any) */