Version keybindings file.
authorRobin Gareus <robin@gareus.org>
Thu, 16 Feb 2017 23:59:48 +0000 (00:59 +0100)
committerRobin Gareus <robin@gareus.org>
Thu, 16 Feb 2017 23:59:48 +0000 (00:59 +0100)
Allow to run both Ardour 5.5 and later (changed bindings name)
with the same config folder.

Like with .color files, custom .keys files won't be taken into account
when updating to a new version.

This is mostly a stopgap solution. Eventually we'll have to come up with a
merge&prune mechanism for bindings or maintain a separate version for
these files. Hopefully some better idea will come up...

gtk2_ardour/keyboard.cc

index 2e24f56abbe6fd76cf28a6a2c441af91decee49e..d5b9dd8c4572679276fea223409e286ef8b257b1 100644 (file)
@@ -23,6 +23,7 @@
 #include "pbd/basename.h"
 
 #include "ardour/filesystem_paths.h"
+#include "ardour/revision.h"
 
 #include "ardour_ui.h"
 #include "public_editor.h"
@@ -103,6 +104,16 @@ ArdourKeyboard::setup_keybindings ()
 
        string lowercase_program_name = downcase (string(PROGRAM_NAME));
 
+#ifndef MIXBUS // not for v4.0 just yet
+       /* extract and append minor vesion */
+       std::string rev (revision);
+       std::size_t pos = rev.find_first_of("-");
+       if (pos != string::npos && pos > 0) {
+               lowercase_program_name += "-";
+               lowercase_program_name += rev.substr (0, pos);
+       }
+#endif
+
        user_keybindings_path = Glib::build_filename (user_config_directory(), lowercase_program_name + binding_filename_suffix);
 
        if (Glib::file_test (user_keybindings_path, Glib::FILE_TEST_EXISTS)) {