diff options
Diffstat (limited to 'libs/ardour/filesystem_paths.cc')
-rw-r--r-- | libs/ardour/filesystem_paths.cc | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/libs/ardour/filesystem_paths.cc b/libs/ardour/filesystem_paths.cc index c0766c066f..c07acb0280 100644 --- a/libs/ardour/filesystem_paths.cc +++ b/libs/ardour/filesystem_paths.cc @@ -19,8 +19,9 @@ #include <cstdlib> #include <iostream> -#include "pbd/error.h" #include "pbd/compose.h" +#include "pbd/convert.h" +#include "pbd/error.h" #include <glibmm/miscutils.h> #include <glibmm/fileutils.h> @@ -41,8 +42,24 @@ namespace ARDOUR { using std::string; +static std::string +user_config_directory_name (int version = -1) +{ + if (version < 0) { + version = atoi (X_(PROGRAM_VERSION)); + } + + const string config_dir_name = string_compose ("%1%2", X_(PROGRAM_NAME), version); + +#if defined (__APPLE__) || defined (PLATFORM_WINDOWS) + return config_dir_name; +#else + return downcase (config_dir_name); +#endif +} + std::string -user_config_directory () +user_config_directory (int version) { static std::string p; @@ -79,7 +96,7 @@ user_config_directory () } #endif // end not __APPLE__ - p = Glib::build_filename (p, user_config_dir_name); + p = Glib::build_filename (p, user_config_directory_name (version)); if (!Glib::file_test (p, Glib::FILE_TEST_EXISTS)) { if (g_mkdir_with_parents (p.c_str(), 0755)) { @@ -134,7 +151,7 @@ user_cache_directory () } #endif // end not __APPLE__ - p = Glib::build_filename (p, user_config_dir_name); + p = Glib::build_filename (p, user_config_directory_name ()); #ifdef PLATFORM_WINDOWS /* On Windows Glib::get_user_data_dir is the folder to use for local |