LIBARDOUR_API extern const char* const route_templates_dir_name;
LIBARDOUR_API extern const char* const surfaces_dir_name;
LIBARDOUR_API extern const char* const ladspa_dir_name;
- LIBARDOUR_API extern const char* const user_config_dir_name;
LIBARDOUR_API extern const char* const panner_dir_name;
LIBARDOUR_API extern const char* const backend_dir_name;
namespace ARDOUR {
/**
- * @return the path to the directory used to store user specific ardour
- * configuration files.
+ * @return the path to the directory used to store user specific
+ * configuration files for the given @param version of the program.
+ * If @param version is negative, the build-time string PROGRAM_VERSION
+ * will be used to determine the version number.
+ *
* @post user_config_directory() exists
+ *
+ *
*/
- LIBARDOUR_API std::string user_config_directory ();
+ LIBARDOUR_API std::string user_config_directory (int version = -1);
/**
* @return the path to the directory used to store user specific
const char* const panner_dir_name = X_("panners");
const char* const backend_dir_name = X_("backends");
-char config_dir_name[] = X_(PROGRAM_NAME PROGRAM_VERSION);
-#if defined (__APPLE__) || defined (PLATFORM_WINDOWS)
-const char* const user_config_dir_name = config_dir_name;
-#else
-#include "pbd/convert.h"
-const char* const user_config_dir_name = PBD::downcase (config_dir_name);
-#endif
-
}
#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>
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;
}
#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)) {
}
#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