diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2015-03-11 10:30:42 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-03-11 10:39:15 -0500 |
commit | 1644fc1068a5c28b78ba70078de3b9b5c7570f72 (patch) | |
tree | 0b1198dfe3f95a691348e7b40fcfabdde5cc4ec6 /libs/ardour/filesystem_paths.cc | |
parent | 99260742d24001976a476959f725a461110a7575 (diff) |
hide user_config_dir_name; alter API for user_config_dir() to allow specification of a version number
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 |