diff options
author | Robin Gareus <robin@gareus.org> | 2016-09-28 13:11:16 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-09-28 13:13:56 +0200 |
commit | cf8cc1944928132c99e382918b3c7c03b2298b80 (patch) | |
tree | 71b2a9056b1bae01dc256023669d95ec39c1b818 /libs/ardour | |
parent | 0fc4a61fa0cc94c08e8e63b2d2f6bca146f036f7 (diff) |
allow to get custom/product/version independent cach dir
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/filesystem_paths.h | 2 | ||||
-rw-r--r-- | libs/ardour/filesystem_paths.cc | 12 |
2 files changed, 8 insertions, 6 deletions
diff --git a/libs/ardour/ardour/filesystem_paths.h b/libs/ardour/ardour/filesystem_paths.h index 83f50fd169..8e291dce97 100644 --- a/libs/ardour/ardour/filesystem_paths.h +++ b/libs/ardour/ardour/filesystem_paths.h @@ -43,7 +43,7 @@ namespace ARDOUR { * caches (e.g. plugin indices, blacklist/whitelist) * it defaults to XDG_CACHE_HOME */ - LIBARDOUR_API std::string user_cache_directory (); + LIBARDOUR_API std::string user_cache_directory (std::string cachename = ""); /** * @return the path used to store a persistent indication diff --git a/libs/ardour/filesystem_paths.cc b/libs/ardour/filesystem_paths.cc index 47b9994cc6..94ebc2830e 100644 --- a/libs/ardour/filesystem_paths.cc +++ b/libs/ardour/filesystem_paths.cc @@ -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 |