mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-12 02:59:45 +00:00
LibCore: Clarify StandardPaths::data_directory() name
Let's make it clear that this is for user data.
This commit is contained in:
parent
8fd7dd44de
commit
3a935aa076
Notes:
github-actions[bot]
2024-10-01 09:04:19 +00:00
Author: https://github.com/AtkinsSJ
Commit: 3a935aa076
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1572
3 changed files with 5 additions and 5 deletions
|
@ -132,7 +132,7 @@ ByteString StandardPaths::config_directory()
|
||||||
return LexicalPath::canonicalized_path(builder.to_byte_string());
|
return LexicalPath::canonicalized_path(builder.to_byte_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteString StandardPaths::data_directory()
|
ByteString StandardPaths::user_data_directory()
|
||||||
{
|
{
|
||||||
if (auto data_directory = get_environment_if_not_empty("XDG_DATA_HOME"sv); data_directory.has_value())
|
if (auto data_directory = get_environment_if_not_empty("XDG_DATA_HOME"sv); data_directory.has_value())
|
||||||
return LexicalPath::canonicalized_path(*data_directory);
|
return LexicalPath::canonicalized_path(*data_directory);
|
||||||
|
@ -220,8 +220,8 @@ ErrorOr<Vector<String>> StandardPaths::font_directories()
|
||||||
// There is no guarantee that this will continue to exist on future versions of Android.
|
// There is no guarantee that this will continue to exist on future versions of Android.
|
||||||
"/system/fonts"_string,
|
"/system/fonts"_string,
|
||||||
# else
|
# else
|
||||||
TRY(String::formatted("{}/fonts"sv, data_directory())),
|
TRY(String::formatted("{}/fonts"sv, user_data_directory())),
|
||||||
TRY(String::formatted("{}/X11/fonts"sv, data_directory())),
|
TRY(String::formatted("{}/X11/fonts"sv, user_data_directory())),
|
||||||
# endif
|
# endif
|
||||||
} };
|
} };
|
||||||
# if !(defined(AK_OS_SERENITY) || defined(AK_OS_MACOS))
|
# if !(defined(AK_OS_SERENITY) || defined(AK_OS_MACOS))
|
||||||
|
|
|
@ -23,7 +23,7 @@ public:
|
||||||
static ByteString videos_directory();
|
static ByteString videos_directory();
|
||||||
static ByteString tempfile_directory();
|
static ByteString tempfile_directory();
|
||||||
static ByteString config_directory();
|
static ByteString config_directory();
|
||||||
static ByteString data_directory();
|
static ByteString user_data_directory();
|
||||||
static ErrorOr<ByteString> runtime_directory();
|
static ErrorOr<ByteString> runtime_directory();
|
||||||
static ErrorOr<Vector<String>> font_directories();
|
static ErrorOr<Vector<String>> font_directories();
|
||||||
};
|
};
|
||||||
|
|
|
@ -42,7 +42,7 @@ static constexpr StringView sql_error(int error_code)
|
||||||
ErrorOr<NonnullRefPtr<Database>> Database::create()
|
ErrorOr<NonnullRefPtr<Database>> Database::create()
|
||||||
{
|
{
|
||||||
// FIXME: Move this to a generic "Ladybird data directory" helper.
|
// FIXME: Move this to a generic "Ladybird data directory" helper.
|
||||||
auto database_path = ByteString::formatted("{}/Ladybird", Core::StandardPaths::data_directory());
|
auto database_path = ByteString::formatted("{}/Ladybird", Core::StandardPaths::user_data_directory());
|
||||||
TRY(Core::Directory::create(database_path, Core::Directory::CreateDirectories::Yes));
|
TRY(Core::Directory::create(database_path, Core::Directory::CreateDirectories::Yes));
|
||||||
|
|
||||||
auto database_file = ByteString::formatted("{}/Ladybird.db", database_path);
|
auto database_file = ByteString::formatted("{}/Ladybird.db", database_path);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue