X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Ffilesystem_paths.cc;h=ee5fc97ad760610d064a96651703b3f2c1e70526;hb=fb01698450e5cb88c7e58fb3a5ebe6294731fdfe;hp=c5cd86459023302a96067b42fdc1efef07ec3916;hpb=4dc63966f0872efe768dad61eb9b8785d06b92d1;p=ardour.git diff --git a/libs/ardour/filesystem_paths.cc b/libs/ardour/filesystem_paths.cc index c5cd864590..ee5fc97ad7 100644 --- a/libs/ardour/filesystem_paths.cc +++ b/libs/ardour/filesystem_paths.cc @@ -20,8 +20,8 @@ #include #include "pbd/compose.h" -#include "pbd/convert.h" #include "pbd/error.h" +#include "pbd/string_convert.h" #include #include @@ -29,7 +29,7 @@ #include "ardour/directory_names.h" #include "ardour/filesystem_paths.h" -#include "i18n.h" +#include "pbd/i18n.h" #ifdef PLATFORM_WINDOWS #include "shlobj.h" @@ -46,21 +46,21 @@ static std::string user_config_directory_name (int version = -1) { if (version < 0) { - version = atoi (X_(PROGRAM_VERSION)); + version = string_to(X_(PROGRAM_VERSION)); } /* ARDOUR::Profile may not be available when this is called, so rely on build-time detection of the product name etc. */ - + #ifdef USE_TRACKS_CODE_FEATURES /* Tracks does not use versioned configuration folders, which may or may not be problematic in the future. */ return X_(PROGRAM_NAME); -#else +#else const string config_dir_name = string_compose ("%1%2", X_(PROGRAM_NAME), version); #if defined (__APPLE__) || defined (PLATFORM_WINDOWS) @@ -70,8 +70,8 @@ user_config_directory_name (int version = -1) /* use lower case folder name on Linux */ return downcase (config_dir_name); #endif -#endif -} +#endif +} std::string user_config_directory (int version) @@ -132,11 +132,9 @@ user_config_directory (int version) } std::string -user_cache_directory () +user_cache_directory (std::string cachename) { - static std::string p; - - if (!p.empty()) return p; + std::string p; #ifdef __APPLE__ p = Glib::build_filename (Glib::get_home_dir(), "Library/Caches"); @@ -169,7 +167,11 @@ user_cache_directory () } #endif // end not __APPLE__ - p = Glib::build_filename (p, user_config_directory_name ()); + if (cachename.empty ()) { + p = Glib::build_filename (p, user_config_directory_name ()); + } else { + p = Glib::build_filename (p, cachename); + } #ifdef PLATFORM_WINDOWS /* On Windows Glib::get_user_data_dir is the folder to use for local @@ -208,7 +210,7 @@ ardour_dll_directory () if (s.empty()) { std::cerr << _("ARDOUR_DLL_PATH not set in environment - exiting\n"); ::exit (1); - } + } return s; #endif } @@ -311,7 +313,7 @@ been_here_before_path (int version) version = atoi (PROGRAM_VERSION); } - return Glib::build_filename (user_config_directory (version), string (".a") + to_string (version, std::dec)); + return Glib::build_filename (user_config_directory (version), string (".a") + to_string (version)); }