mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-19 15:43:20 +00:00
LibCore: Add a standard path for cache data
This commit is contained in:
parent
d349e91339
commit
62e52640d0
Notes:
github-actions[bot]
2025-10-14 11:42:22 +00:00
Author: https://github.com/trflynn89
Commit: 62e52640d0
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6435
2 changed files with 22 additions and 0 deletions
|
@ -129,6 +129,27 @@ ByteString StandardPaths::videos_directory()
|
||||||
return LexicalPath::canonicalized_path(builder.to_byte_string());
|
return LexicalPath::canonicalized_path(builder.to_byte_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ByteString StandardPaths::cache_directory()
|
||||||
|
{
|
||||||
|
#if defined(AK_OS_WINDOWS) || defined(AK_OS_HAIKU)
|
||||||
|
return user_data_directory();
|
||||||
|
#else
|
||||||
|
if (auto cache_directory = get_environment_if_not_empty("XDG_CACHE_HOME"sv); cache_directory.has_value())
|
||||||
|
return LexicalPath::canonicalized_path(*cache_directory);
|
||||||
|
|
||||||
|
StringBuilder builder;
|
||||||
|
builder.append(home_directory());
|
||||||
|
|
||||||
|
# if defined(AK_OS_MACOS)
|
||||||
|
builder.append("/Library/Caches"sv);
|
||||||
|
# else
|
||||||
|
builder.append("/.cache"sv);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
return LexicalPath::canonicalized_path(builder.to_byte_string());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
ByteString StandardPaths::config_directory()
|
ByteString StandardPaths::config_directory()
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
|
|
|
@ -22,6 +22,7 @@ public:
|
||||||
static ByteString pictures_directory();
|
static ByteString pictures_directory();
|
||||||
static ByteString videos_directory();
|
static ByteString videos_directory();
|
||||||
static ByteString tempfile_directory();
|
static ByteString tempfile_directory();
|
||||||
|
static ByteString cache_directory();
|
||||||
static ByteString config_directory();
|
static ByteString config_directory();
|
||||||
static ByteString user_data_directory();
|
static ByteString user_data_directory();
|
||||||
static Vector<ByteString> system_data_directories();
|
static Vector<ByteString> system_data_directories();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue