From 3a935aa07641645797e44683882de72be3f6fd83 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Mon, 30 Sep 2024 10:36:11 +0100 Subject: [PATCH] LibCore: Clarify StandardPaths::data_directory() name Let's make it clear that this is for user data. --- Userland/Libraries/LibCore/StandardPaths.cpp | 6 +++--- Userland/Libraries/LibCore/StandardPaths.h | 2 +- Userland/Libraries/LibWebView/Database.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Userland/Libraries/LibCore/StandardPaths.cpp b/Userland/Libraries/LibCore/StandardPaths.cpp index 9a6a24a8cd3..35ebee7cdca 100644 --- a/Userland/Libraries/LibCore/StandardPaths.cpp +++ b/Userland/Libraries/LibCore/StandardPaths.cpp @@ -132,7 +132,7 @@ ByteString StandardPaths::config_directory() 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()) return LexicalPath::canonicalized_path(*data_directory); @@ -220,8 +220,8 @@ ErrorOr> StandardPaths::font_directories() // There is no guarantee that this will continue to exist on future versions of Android. "/system/fonts"_string, # else - TRY(String::formatted("{}/fonts"sv, data_directory())), - TRY(String::formatted("{}/X11/fonts"sv, data_directory())), + TRY(String::formatted("{}/fonts"sv, user_data_directory())), + TRY(String::formatted("{}/X11/fonts"sv, user_data_directory())), # endif } }; # if !(defined(AK_OS_SERENITY) || defined(AK_OS_MACOS)) diff --git a/Userland/Libraries/LibCore/StandardPaths.h b/Userland/Libraries/LibCore/StandardPaths.h index e82115d19b8..cd358864e2c 100644 --- a/Userland/Libraries/LibCore/StandardPaths.h +++ b/Userland/Libraries/LibCore/StandardPaths.h @@ -23,7 +23,7 @@ public: static ByteString videos_directory(); static ByteString tempfile_directory(); static ByteString config_directory(); - static ByteString data_directory(); + static ByteString user_data_directory(); static ErrorOr runtime_directory(); static ErrorOr> font_directories(); }; diff --git a/Userland/Libraries/LibWebView/Database.cpp b/Userland/Libraries/LibWebView/Database.cpp index 7964a7afe86..e78174a38ba 100644 --- a/Userland/Libraries/LibWebView/Database.cpp +++ b/Userland/Libraries/LibWebView/Database.cpp @@ -42,7 +42,7 @@ static constexpr StringView sql_error(int error_code) ErrorOr> Database::create() { // 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)); auto database_file = ByteString::formatted("{}/Ladybird.db", database_path);