diff options
| author | Pawel Bylica <chfast@gmail.com> | 2015-11-02 09:49:17 +0000 |
|---|---|---|
| committer | Pawel Bylica <chfast@gmail.com> | 2015-11-02 09:49:17 +0000 |
| commit | 0e97e5cb1907ef55966fd27055698515e522c0f0 (patch) | |
| tree | 96385d621315224f0adcac2af1413d7e64d7bb23 /llvm/include | |
| parent | 8671c6e03dc6a1e10d41ad825075cb912b05c570 (diff) | |
| download | bcm5719-llvm-0e97e5cb1907ef55966fd27055698515e522c0f0.tar.gz bcm5719-llvm-0e97e5cb1907ef55966fd27055698515e522c0f0.zip | |
[Support] Extend sys::path with user_cache_directory function.
Summary:
The new function sys::path::user_cache_directory tries to discover
a directory suitable for cache storage for current system user.
On Windows and Darwin it returns a path to system-specific user cache directory.
On Linux it follows XDG Base Directory Specification, what is:
- use non-empty $XDG_CACHE_HOME env var,
- use $HOME/.cache.
Reviewers: chapuni, aaron.ballman, rafael
Subscribers: rafael, aaron.ballman, llvm-commits
Differential Revision: http://reviews.llvm.org/D13801
llvm-svn: 251784
Diffstat (limited to 'llvm/include')
| -rw-r--r-- | llvm/include/llvm/Support/Path.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/include/llvm/Support/Path.h b/llvm/include/llvm/Support/Path.h index 0853f916b58..1e56be4a5fc 100644 --- a/llvm/include/llvm/Support/Path.h +++ b/llvm/include/llvm/Support/Path.h @@ -325,6 +325,22 @@ void system_temp_directory(bool erasedOnReboot, SmallVectorImpl<char> &result); /// @result True if a home directory is set, false otherwise. bool home_directory(SmallVectorImpl<char> &result); +/// @brief Get the user's cache directory. +/// +/// Expect the resulting path to be a directory shared with other +/// applications/services used by the user. Params \p Path1 to \p Path3 can be +/// used to append additional directory names to the resulting path. Recommended +/// pattern is <user_cache_directory>/<vendor>/<application>. +/// +/// @param Result Holds the resulting path. +/// @param Path1 Additional path to be appended to the user's cache directory +/// path. "" can be used to append nothing. +/// @param Path2 Second additional path to be appended. +/// @param Path3 Third additional path to be appended. +/// @result True if a cache directory path is set, false otherwise. +bool user_cache_directory(SmallVectorImpl<char> &Result, const Twine &Path1, + const Twine &Path2 = "", const Twine &Path3 = ""); + /// @brief Has root name? /// /// root_name != "" |

