From acde7d12b0d2870feba3ebaaaf2ef99ac6fb41b3 Mon Sep 17 00:00:00 2001 From: networkException Date: Sat, 21 Aug 2021 16:33:54 +0200 Subject: [PATCH] Everywhere: Rename get in ConfigFile::get_for_{lib,app,system} to open This patch brings the ConfigFile helpers for opening lib, app and system configs more inline with the regular ConfigFile::open functions. --- Userland/Applets/Audio/main.cpp | 4 ++-- Userland/Applications/Browser/BrowserWindow.cpp | 8 ++++---- Userland/Applications/Browser/DownloadWidget.cpp | 4 ++-- Userland/Applications/Browser/main.cpp | 2 +- .../DisplaySettings/BackgroundSettingsWidget.cpp | 4 ++-- Userland/Applications/FileManager/main.cpp | 4 ++-- Userland/Applications/HexEditor/HexEditorWidget.cpp | 2 +- Userland/Applications/IRCClient/IRCClient.cpp | 2 +- Userland/Applications/KeyboardSettings/main.cpp | 2 +- Userland/Applications/Mail/MailWidget.cpp | 2 +- Userland/Applications/MailSettings/MailSettingsWindow.cpp | 2 +- Userland/Applications/Terminal/main.cpp | 2 +- Userland/Applications/TextEditor/MainWidget.cpp | 2 +- Userland/DevTools/HackStudio/TerminalWrapper.cpp | 2 +- Userland/Games/2048/main.cpp | 2 +- Userland/Games/Chess/main.cpp | 2 +- Userland/Games/FlappyBug/main.cpp | 2 +- Userland/Games/Hearts/main.cpp | 2 +- Userland/Games/Minesweeper/Field.cpp | 6 +++--- Userland/Games/Minesweeper/main.cpp | 2 +- Userland/Games/Pong/main.cpp | 2 +- Userland/Games/Snake/SnakeGame.cpp | 4 ++-- Userland/Games/Snake/main.cpp | 2 +- Userland/Games/Solitaire/main.cpp | 2 +- Userland/Games/Spider/main.cpp | 2 +- Userland/Libraries/LibCore/ConfigFile.cpp | 6 +++--- Userland/Libraries/LibCore/ConfigFile.h | 6 +++--- Userland/Libraries/LibGUI/Desktop.cpp | 2 +- Userland/Libraries/LibLine/Editor.cpp | 2 +- Userland/Libraries/LibTLS/TLSv12.cpp | 2 +- Userland/Services/AudioServer/main.cpp | 2 +- Userland/Services/KeyboardPreferenceLoader/main.cpp | 2 +- Userland/Services/LaunchServer/main.cpp | 2 +- Userland/Services/LookupServer/LookupServer.cpp | 2 +- Userland/Services/SystemServer/main.cpp | 2 +- Userland/Services/Taskbar/TaskbarWindow.cpp | 2 +- Userland/Utilities/run-tests.cpp | 2 +- 37 files changed, 51 insertions(+), 51 deletions(-) diff --git a/Userland/Applets/Audio/main.cpp b/Userland/Applets/Audio/main.cpp index 1d00dee0ad..ed868c643a 100644 --- a/Userland/Applets/Audio/main.cpp +++ b/Userland/Applets/Audio/main.cpp @@ -211,9 +211,9 @@ int main(int argc, char** argv) return 1; } - auto config = Core::ConfigFile::get_for_app("AudioApplet", Core::ConfigFile::AllowWriting::Yes); + auto config = Core::ConfigFile::open_for_app("AudioApplet", Core::ConfigFile::AllowWriting::Yes); // To not upset the audio server state, we responsibly read this once. - auto audio_master_config = Core::ConfigFile::get_for_app("Audio"); + auto audio_master_config = Core::ConfigFile::open_for_app("Audio"); auto app = GUI::Application::construct(argc, argv); diff --git a/Userland/Applications/Browser/BrowserWindow.cpp b/Userland/Applications/Browser/BrowserWindow.cpp index 8a8658d555..17605bc13f 100644 --- a/Userland/Applications/Browser/BrowserWindow.cpp +++ b/Userland/Applications/Browser/BrowserWindow.cpp @@ -277,7 +277,7 @@ void BrowserWindow::build_menus() m_change_homepage_action = GUI::Action::create( "Set Homepage URL", [this](auto&) { - auto config = Core::ConfigFile::get_for_app("Browser", Core::ConfigFile::AllowWriting::Yes); + auto config = Core::ConfigFile::open_for_app("Browser", Core::ConfigFile::AllowWriting::Yes); String homepage_url = config->read_entry("Preferences", "Home", "about:blank"); if (GUI::InputBox::show(this, homepage_url, "Enter URL", "Change homepage URL") == GUI::InputBox::ExecOK) { if (URL(homepage_url).is_valid()) { @@ -300,7 +300,7 @@ void BrowserWindow::build_menus() auto action = GUI::Action::create_checkable( name, [&](auto&) { g_search_engine = url_format; - auto config = Core::ConfigFile::get_for_app("Browser", Core::ConfigFile::AllowWriting::Yes); + auto config = Core::ConfigFile::open_for_app("Browser", Core::ConfigFile::AllowWriting::Yes); config->write_entry("Preferences", "SearchEngine", g_search_engine); }, this); @@ -317,7 +317,7 @@ void BrowserWindow::build_menus() m_disable_search_engine_action = GUI::Action::create_checkable( "Disable", [](auto&) { g_search_engine = {}; - auto config = Core::ConfigFile::get_for_app("Browser", Core::ConfigFile::AllowWriting::Yes); + auto config = Core::ConfigFile::open_for_app("Browser", Core::ConfigFile::AllowWriting::Yes); config->write_entry("Preferences", "SearchEngine", g_search_engine); }, this); @@ -347,7 +347,7 @@ void BrowserWindow::build_menus() } g_search_engine = search_engine; - auto config = Core::ConfigFile::get_for_app("Browser", Core::ConfigFile::AllowWriting::Yes); + auto config = Core::ConfigFile::open_for_app("Browser", Core::ConfigFile::AllowWriting::Yes); config->write_entry("Preferences", "SearchEngine", g_search_engine); action.set_status_tip(search_engine); }); diff --git a/Userland/Applications/Browser/DownloadWidget.cpp b/Userland/Applications/Browser/DownloadWidget.cpp index ee9aa889b6..d18385be44 100644 --- a/Userland/Applications/Browser/DownloadWidget.cpp +++ b/Userland/Applications/Browser/DownloadWidget.cpp @@ -36,7 +36,7 @@ DownloadWidget::DownloadWidget(const URL& url) m_destination_path = builder.to_string(); } - auto browser_config = Core::ConfigFile::get_for_app("Browser"); + auto browser_config = Core::ConfigFile::open_for_app("Browser"); auto close_on_finish = browser_config->read_bool_entry("Preferences", "CloseDownloadWidgetOnFinish", false); m_elapsed_timer.start(); @@ -90,7 +90,7 @@ DownloadWidget::DownloadWidget(const URL& url) m_close_on_finish_checkbox->set_checked(close_on_finish); m_close_on_finish_checkbox->on_checked = [&](bool checked) { - auto browser_config = Core::ConfigFile::get_for_app("Browser", Core::ConfigFile::AllowWriting::Yes); + auto browser_config = Core::ConfigFile::open_for_app("Browser", Core::ConfigFile::AllowWriting::Yes); browser_config->write_bool_entry("Preferences", "CloseDownloadWidgetOnFinish", checked); }; diff --git a/Userland/Applications/Browser/main.cpp b/Userland/Applications/Browser/main.cpp index 45f10779ab..91f9a14c19 100644 --- a/Userland/Applications/Browser/main.cpp +++ b/Userland/Applications/Browser/main.cpp @@ -103,7 +103,7 @@ int main(int argc, char** argv) auto app_icon = GUI::Icon::default_icon("app-browser"); - auto m_config = Core::ConfigFile::get_for_app("Browser"); + auto m_config = Core::ConfigFile::open_for_app("Browser"); Browser::g_home_url = m_config->read_entry("Preferences", "Home", "about:blank"); Browser::g_search_engine = m_config->read_entry("Preferences", "SearchEngine", {}); diff --git a/Userland/Applications/DisplaySettings/BackgroundSettingsWidget.cpp b/Userland/Applications/DisplaySettings/BackgroundSettingsWidget.cpp index ccda3af442..19d03773a0 100644 --- a/Userland/Applications/DisplaySettings/BackgroundSettingsWidget.cpp +++ b/Userland/Applications/DisplaySettings/BackgroundSettingsWidget.cpp @@ -86,7 +86,7 @@ void BackgroundSettingsWidget::create_frame() void BackgroundSettingsWidget::load_current_settings() { auto ws_config = Core::ConfigFile::open("/etc/WindowServer.ini"); - auto wm_config = Core::ConfigFile::get_for_app("WindowManager"); + auto wm_config = Core::ConfigFile::open_for_app("WindowManager"); auto selected_wallpaper = wm_config->read_entry("Background", "Wallpaper", ""); if (!selected_wallpaper.is_empty()) { @@ -118,7 +118,7 @@ void BackgroundSettingsWidget::load_current_settings() void BackgroundSettingsWidget::apply_settings() { - auto wm_config = Core::ConfigFile::get_for_app("WindowManager", Core::ConfigFile::AllowWriting::Yes); + auto wm_config = Core::ConfigFile::open_for_app("WindowManager", Core::ConfigFile::AllowWriting::Yes); wm_config->write_entry("Background", "Wallpaper", m_monitor_widget->wallpaper()); if (!m_monitor_widget->wallpaper().is_empty()) { diff --git a/Userland/Applications/FileManager/main.cpp b/Userland/Applications/FileManager/main.cpp index 4e09c9aa47..15ac38240e 100644 --- a/Userland/Applications/FileManager/main.cpp +++ b/Userland/Applications/FileManager/main.cpp @@ -75,7 +75,7 @@ int main(int argc, char** argv) return 1; } - RefPtr config = Core::ConfigFile::get_for_app("FileManager", Core::ConfigFile::AllowWriting::Yes); + RefPtr config = Core::ConfigFile::open_for_app("FileManager", Core::ConfigFile::AllowWriting::Yes); Core::ArgsParser args_parser; bool is_desktop_mode { false }, is_selection_mode { false }, ignore_path_resolution { false }; @@ -415,7 +415,7 @@ int run_in_desktop_mode([[maybe_unused]] RefPtr config) } }; - auto wm_config = Core::ConfigFile::get_for_app("WindowManager"); + auto wm_config = Core::ConfigFile::open_for_app("WindowManager"); auto selected_wallpaper = wm_config->read_entry("Background", "Wallpaper", ""); if (!selected_wallpaper.is_empty()) { GUI::Desktop::the().set_wallpaper(selected_wallpaper, false); diff --git a/Userland/Applications/HexEditor/HexEditorWidget.cpp b/Userland/Applications/HexEditor/HexEditorWidget.cpp index c064a7f8b2..495e898eb1 100644 --- a/Userland/Applications/HexEditor/HexEditorWidget.cpp +++ b/Userland/Applications/HexEditor/HexEditorWidget.cpp @@ -35,7 +35,7 @@ HexEditorWidget::HexEditorWidget() { load_from_gml(hex_editor_window_gml); - m_config = Core::ConfigFile::get_for_app("HexEditor", Core::ConfigFile::AllowWriting::Yes); + m_config = Core::ConfigFile::open_for_app("HexEditor", Core::ConfigFile::AllowWriting::Yes); m_toolbar = *find_descendant_of_type_named("toolbar"); m_toolbar_container = *find_descendant_of_type_named("toolbar_container"); diff --git a/Userland/Applications/IRCClient/IRCClient.cpp b/Userland/Applications/IRCClient/IRCClient.cpp index f95a6cc7a1..fc92f2f7bb 100644 --- a/Userland/Applications/IRCClient/IRCClient.cpp +++ b/Userland/Applications/IRCClient/IRCClient.cpp @@ -47,7 +47,7 @@ IRCClient::IRCClient(String server, int port) : m_nickname("seren1ty") , m_client_window_list_model(IRCWindowListModel::create(*this)) , m_log(IRCLogBuffer::create()) - , m_config(Core::ConfigFile::get_for_app("IRCClient", Core::ConfigFile::AllowWriting::Yes)) + , m_config(Core::ConfigFile::open_for_app("IRCClient", Core::ConfigFile::AllowWriting::Yes)) { struct passwd* user_pw = getpwuid(getuid()); m_socket = Core::TCPSocket::construct(this); diff --git a/Userland/Applications/KeyboardSettings/main.cpp b/Userland/Applications/KeyboardSettings/main.cpp index 5e30a1dc9f..40af1946b9 100644 --- a/Userland/Applications/KeyboardSettings/main.cpp +++ b/Userland/Applications/KeyboardSettings/main.cpp @@ -38,7 +38,7 @@ int main(int argc, char** argv) return 1; } - auto config = Core::ConfigFile::get_for_app("KeyboardSettings", Core::ConfigFile::AllowWriting::Yes); + auto config = Core::ConfigFile::open_for_app("KeyboardSettings", Core::ConfigFile::AllowWriting::Yes); if (unveil(config->filename().characters(), "rwc") < 0) { perror("unveil"); return 1; diff --git a/Userland/Applications/Mail/MailWidget.cpp b/Userland/Applications/Mail/MailWidget.cpp index 524832e6e5..b032232760 100644 --- a/Userland/Applications/Mail/MailWidget.cpp +++ b/Userland/Applications/Mail/MailWidget.cpp @@ -100,7 +100,7 @@ MailWidget::~MailWidget() bool MailWidget::connect_and_login() { - auto config = Core::ConfigFile::get_for_app("Mail"); + auto config = Core::ConfigFile::open_for_app("Mail"); auto server = config->read_entry("Connection", "Server", {}); diff --git a/Userland/Applications/MailSettings/MailSettingsWindow.cpp b/Userland/Applications/MailSettings/MailSettingsWindow.cpp index c968a715f4..813efdb3b2 100644 --- a/Userland/Applications/MailSettings/MailSettingsWindow.cpp +++ b/Userland/Applications/MailSettings/MailSettingsWindow.cpp @@ -43,7 +43,7 @@ void MailSettingsWindow::write_values() MailSettingsWindow::MailSettingsWindow() { - m_config = Core::ConfigFile::get_for_app("Mail", Core::ConfigFile::AllowWriting::Yes); + m_config = Core::ConfigFile::open_for_app("Mail", Core::ConfigFile::AllowWriting::Yes); if (unveil(m_config->filename().characters(), "rwc") < 0) { perror("unveil"); GUI::Application::the()->quit(); diff --git a/Userland/Applications/Terminal/main.cpp b/Userland/Applications/Terminal/main.cpp index baaec8313c..498c27d653 100644 --- a/Userland/Applications/Terminal/main.cpp +++ b/Userland/Applications/Terminal/main.cpp @@ -291,7 +291,7 @@ int main(int argc, char** argv) return 1; } - RefPtr config = Core::ConfigFile::get_for_app("Terminal", Core::ConfigFile::AllowWriting::Yes); + RefPtr config = Core::ConfigFile::open_for_app("Terminal", Core::ConfigFile::AllowWriting::Yes); Core::File::ensure_parent_directories(config->filename()); int ptm_fd; diff --git a/Userland/Applications/TextEditor/MainWidget.cpp b/Userland/Applications/TextEditor/MainWidget.cpp index ac98492029..3d734f3c1b 100644 --- a/Userland/Applications/TextEditor/MainWidget.cpp +++ b/Userland/Applications/TextEditor/MainWidget.cpp @@ -47,7 +47,7 @@ MainWidget::MainWidget() { load_from_gml(text_editor_window_gml); - m_config = Core::ConfigFile::get_for_app("TextEditor", Core::ConfigFile::AllowWriting::Yes); + m_config = Core::ConfigFile::open_for_app("TextEditor", Core::ConfigFile::AllowWriting::Yes); m_toolbar = *find_descendant_of_type_named("toolbar"); m_toolbar_container = *find_descendant_of_type_named("toolbar_container"); diff --git a/Userland/DevTools/HackStudio/TerminalWrapper.cpp b/Userland/DevTools/HackStudio/TerminalWrapper.cpp index ccf5f8fe5d..e1ea7beefe 100644 --- a/Userland/DevTools/HackStudio/TerminalWrapper.cpp +++ b/Userland/DevTools/HackStudio/TerminalWrapper.cpp @@ -157,7 +157,7 @@ TerminalWrapper::TerminalWrapper(bool user_spawned) { set_layout(); - RefPtr config = Core::ConfigFile::get_for_app("Terminal"); + RefPtr config = Core::ConfigFile::open_for_app("Terminal"); m_terminal_widget = add(-1, false, config); if (user_spawned) diff --git a/Userland/Games/2048/main.cpp b/Userland/Games/2048/main.cpp index eb7b9aeccf..1182b97223 100644 --- a/Userland/Games/2048/main.cpp +++ b/Userland/Games/2048/main.cpp @@ -37,7 +37,7 @@ int main(int argc, char** argv) auto window = GUI::Window::construct(); - auto config = Core::ConfigFile::get_for_app("2048", Core::ConfigFile::AllowWriting::Yes); + auto config = Core::ConfigFile::open_for_app("2048", Core::ConfigFile::AllowWriting::Yes); size_t board_size = config->read_num_entry("", "board_size", 4); u32 target_tile = config->read_num_entry("", "target_tile", 2048); diff --git a/Userland/Games/Chess/main.cpp b/Userland/Games/Chess/main.cpp index b883eb9a98..1f4d0a83fc 100644 --- a/Userland/Games/Chess/main.cpp +++ b/Userland/Games/Chess/main.cpp @@ -26,7 +26,7 @@ int main(int argc, char** argv) auto window = GUI::Window::construct(); auto& widget = window->set_main_widget(); - RefPtr config = Core::ConfigFile::get_for_app("Chess", Core::ConfigFile::AllowWriting::Yes); + RefPtr config = Core::ConfigFile::open_for_app("Chess", Core::ConfigFile::AllowWriting::Yes); if (pledge("stdio rpath wpath cpath recvfd sendfd thread proc exec", nullptr) < 0) { perror("pledge"); diff --git a/Userland/Games/FlappyBug/main.cpp b/Userland/Games/FlappyBug/main.cpp index cfce33f1a7..c8bd640d46 100644 --- a/Userland/Games/FlappyBug/main.cpp +++ b/Userland/Games/FlappyBug/main.cpp @@ -22,7 +22,7 @@ int main(int argc, char** argv) } auto app = GUI::Application::construct(argc, argv); - auto config = Core::ConfigFile::get_for_app("FlappyBug", Core::ConfigFile::AllowWriting::Yes); + auto config = Core::ConfigFile::open_for_app("FlappyBug", Core::ConfigFile::AllowWriting::Yes); if (pledge("stdio rpath wpath cpath recvfd sendfd", nullptr) < 0) { perror("pledge"); diff --git a/Userland/Games/Hearts/main.cpp b/Userland/Games/Hearts/main.cpp index 73c9b8da21..70111b3bed 100644 --- a/Userland/Games/Hearts/main.cpp +++ b/Userland/Games/Hearts/main.cpp @@ -26,7 +26,7 @@ int main(int argc, char** argv) { auto app = GUI::Application::construct(argc, argv); auto app_icon = GUI::Icon::default_icon("app-hearts"); - auto config = Core::ConfigFile::get_for_app("Hearts", Core::ConfigFile::AllowWriting::Yes); + auto config = Core::ConfigFile::open_for_app("Hearts", Core::ConfigFile::AllowWriting::Yes); if (pledge("stdio recvfd sendfd rpath wpath cpath", nullptr) < 0) { perror("pledge"); diff --git a/Userland/Games/Minesweeper/Field.cpp b/Userland/Games/Minesweeper/Field.cpp index 9191552be4..fd05f2ff4a 100644 --- a/Userland/Games/Minesweeper/Field.cpp +++ b/Userland/Games/Minesweeper/Field.cpp @@ -137,7 +137,7 @@ Field::Field(GUI::Label& flag_label, GUI::Label& time_label, GUI::Button& face_b set_face(Face::Default); { - auto config = Core::ConfigFile::get_for_app("Minesweeper"); + auto config = Core::ConfigFile::open_for_app("Minesweeper"); bool single_chording = config->read_num_entry("Minesweeper", "SingleChording", false); int mine_count = config->read_num_entry("Game", "MineCount", 10); int rows = config->read_num_entry("Game", "Rows", 9); @@ -488,7 +488,7 @@ void Field::set_field_size(size_t rows, size_t columns, size_t mine_count) if (m_rows == rows && m_columns == columns && m_mine_count == mine_count) return; { - auto config = Core::ConfigFile::get_for_app("Minesweeper", Core::ConfigFile::AllowWriting::Yes); + auto config = Core::ConfigFile::open_for_app("Minesweeper", Core::ConfigFile::AllowWriting::Yes); config->write_num_entry("Game", "MineCount", mine_count); config->write_num_entry("Game", "Rows", rows); config->write_num_entry("Game", "Columns", columns); @@ -503,7 +503,7 @@ void Field::set_field_size(size_t rows, size_t columns, size_t mine_count) void Field::set_single_chording(bool enabled) { - auto config = Core::ConfigFile::get_for_app("Minesweeper", Core::ConfigFile::AllowWriting::Yes); + auto config = Core::ConfigFile::open_for_app("Minesweeper", Core::ConfigFile::AllowWriting::Yes); m_single_chording = enabled; config->write_bool_entry("Minesweeper", "SingleChording", m_single_chording); } diff --git a/Userland/Games/Minesweeper/main.cpp b/Userland/Games/Minesweeper/main.cpp index 2df11e6c61..839dd27c0b 100644 --- a/Userland/Games/Minesweeper/main.cpp +++ b/Userland/Games/Minesweeper/main.cpp @@ -33,7 +33,7 @@ int main(int argc, char** argv) return 1; } - auto config = Core::ConfigFile::get_for_app("Minesweeper"); + auto config = Core::ConfigFile::open_for_app("Minesweeper"); if (unveil("/res", "r") < 0) { perror("unveil"); diff --git a/Userland/Games/Pong/main.cpp b/Userland/Games/Pong/main.cpp index 09210e1e07..40b6e4e648 100644 --- a/Userland/Games/Pong/main.cpp +++ b/Userland/Games/Pong/main.cpp @@ -28,7 +28,7 @@ int main(int argc, char** argv) return 1; } - auto config = Core::ConfigFile::get_for_app("Pong"); + auto config = Core::ConfigFile::open_for_app("Pong"); if (unveil("/res", "r") < 0) { perror("unveil"); diff --git a/Userland/Games/Snake/SnakeGame.cpp b/Userland/Games/Snake/SnakeGame.cpp index e8bf10737e..3aec0c13d7 100644 --- a/Userland/Games/Snake/SnakeGame.cpp +++ b/Userland/Games/Snake/SnakeGame.cpp @@ -23,7 +23,7 @@ SnakeGame::SnakeGame() srand(time(nullptr)); reset(); - auto config = Core::ConfigFile::get_for_app("Snake"); + auto config = Core::ConfigFile::open_for_app("Snake"); m_high_score = config->read_num_entry("Snake", "HighScore", 0); m_high_score_text = String::formatted("Best: {}", m_high_score); } @@ -131,7 +131,7 @@ void SnakeGame::timer_event(Core::TimerEvent&) m_high_score = m_score; m_high_score_text = String::formatted("Best: {}", m_high_score); update(high_score_rect()); - auto config = Core::ConfigFile::get_for_app("Snake", Core::ConfigFile::AllowWriting::Yes); + auto config = Core::ConfigFile::open_for_app("Snake", Core::ConfigFile::AllowWriting::Yes); config->write_num_entry("Snake", "HighScore", m_high_score); } update(score_rect()); diff --git a/Userland/Games/Snake/main.cpp b/Userland/Games/Snake/main.cpp index 1ddae48033..e4294cb261 100644 --- a/Userland/Games/Snake/main.cpp +++ b/Userland/Games/Snake/main.cpp @@ -31,7 +31,7 @@ int main(int argc, char** argv) return 1; } - auto config = Core::ConfigFile::get_for_app("Snake"); + auto config = Core::ConfigFile::open_for_app("Snake"); if (unveil("/res", "r") < 0) { perror("unveil"); diff --git a/Userland/Games/Solitaire/main.cpp b/Userland/Games/Solitaire/main.cpp index a51fca313b..176c32cf87 100644 --- a/Userland/Games/Solitaire/main.cpp +++ b/Userland/Games/Solitaire/main.cpp @@ -24,7 +24,7 @@ int main(int argc, char** argv) { auto app = GUI::Application::construct(argc, argv); auto app_icon = GUI::Icon::default_icon("app-solitaire"); - auto config = Core::ConfigFile::get_for_app("Solitaire", Core::ConfigFile::AllowWriting::Yes); + auto config = Core::ConfigFile::open_for_app("Solitaire", Core::ConfigFile::AllowWriting::Yes); if (pledge("stdio recvfd sendfd rpath wpath cpath", nullptr) < 0) { perror("pledge"); diff --git a/Userland/Games/Spider/main.cpp b/Userland/Games/Spider/main.cpp index fa2c8cd4d3..50e910af39 100644 --- a/Userland/Games/Spider/main.cpp +++ b/Userland/Games/Spider/main.cpp @@ -39,7 +39,7 @@ int main(int argc, char** argv) { auto app = GUI::Application::construct(argc, argv); auto app_icon = GUI::Icon::default_icon("app-spider"); - auto config = Core::ConfigFile::get_for_app("Spider", Core::ConfigFile::AllowWriting::Yes); + auto config = Core::ConfigFile::open_for_app("Spider", Core::ConfigFile::AllowWriting::Yes); if (pledge("stdio recvfd sendfd rpath wpath cpath", nullptr) < 0) { perror("pledge"); diff --git a/Userland/Libraries/LibCore/ConfigFile.cpp b/Userland/Libraries/LibCore/ConfigFile.cpp index a53a2a0aa3..d9edd1c00a 100644 --- a/Userland/Libraries/LibCore/ConfigFile.cpp +++ b/Userland/Libraries/LibCore/ConfigFile.cpp @@ -14,7 +14,7 @@ namespace Core { -NonnullRefPtr ConfigFile::get_for_lib(String const& lib_name, AllowWriting allow_altering) +NonnullRefPtr ConfigFile::open_for_lib(String const& lib_name, AllowWriting allow_altering) { String directory = StandardPaths::config_directory(); auto path = String::formatted("{}/lib/{}.ini", directory, lib_name); @@ -22,14 +22,14 @@ NonnullRefPtr ConfigFile::get_for_lib(String const& lib_name, AllowW return adopt_ref(*new ConfigFile(path, allow_altering)); } -NonnullRefPtr ConfigFile::get_for_app(String const& app_name, AllowWriting allow_altering) +NonnullRefPtr ConfigFile::open_for_app(String const& app_name, AllowWriting allow_altering) { String directory = StandardPaths::config_directory(); auto path = String::formatted("{}/{}.ini", directory, app_name); return adopt_ref(*new ConfigFile(path, allow_altering)); } -NonnullRefPtr ConfigFile::get_for_system(String const& app_name, AllowWriting allow_altering) +NonnullRefPtr ConfigFile::open_for_system(String const& app_name, AllowWriting allow_altering) { auto path = String::formatted("/etc/{}.ini", app_name); return adopt_ref(*new ConfigFile(path, allow_altering)); diff --git a/Userland/Libraries/LibCore/ConfigFile.h b/Userland/Libraries/LibCore/ConfigFile.h index aa0528f2f2..d2262cbb56 100644 --- a/Userland/Libraries/LibCore/ConfigFile.h +++ b/Userland/Libraries/LibCore/ConfigFile.h @@ -24,9 +24,9 @@ public: No, }; - static NonnullRefPtr get_for_lib(String const& lib_name, AllowWriting = AllowWriting::No); - static NonnullRefPtr get_for_app(String const& app_name, AllowWriting = AllowWriting::No); - static NonnullRefPtr get_for_system(String const& app_name, AllowWriting = AllowWriting::No); + static NonnullRefPtr open_for_lib(String const& lib_name, AllowWriting = AllowWriting::No); + static NonnullRefPtr open_for_app(String const& app_name, AllowWriting = AllowWriting::No); + static NonnullRefPtr open_for_system(String const& app_name, AllowWriting = AllowWriting::No); static NonnullRefPtr open(String const& filename, AllowWriting = AllowWriting::No); static NonnullRefPtr open(String const& filename, int fd); ~ConfigFile(); diff --git a/Userland/Libraries/LibGUI/Desktop.cpp b/Userland/Libraries/LibGUI/Desktop.cpp index 90c05247d1..465c3976cd 100644 --- a/Userland/Libraries/LibGUI/Desktop.cpp +++ b/Userland/Libraries/LibGUI/Desktop.cpp @@ -59,7 +59,7 @@ bool Desktop::set_wallpaper(const StringView& path, bool save_config) auto ret_val = WindowServerConnection::the().wait_for_specific_message()->success(); if (ret_val && save_config) { - RefPtr config = Core::ConfigFile::get_for_app("WindowManager", Core::ConfigFile::AllowWriting::Yes); + RefPtr config = Core::ConfigFile::open_for_app("WindowManager", Core::ConfigFile::AllowWriting::Yes); dbgln("Saving wallpaper path '{}' to config file at {}", path, config->filename()); config->write_entry("Background", "Wallpaper", path); config->sync(); diff --git a/Userland/Libraries/LibLine/Editor.cpp b/Userland/Libraries/LibLine/Editor.cpp index 57790728e0..f274d120ab 100644 --- a/Userland/Libraries/LibLine/Editor.cpp +++ b/Userland/Libraries/LibLine/Editor.cpp @@ -39,7 +39,7 @@ namespace Line { Configuration Configuration::from_config(const StringView& libname) { Configuration configuration; - auto config_file = Core::ConfigFile::get_for_lib(libname); + auto config_file = Core::ConfigFile::open_for_lib(libname); // Read behaviour options. auto refresh = config_file->read_entry("behaviour", "refresh", "lazy"); diff --git a/Userland/Libraries/LibTLS/TLSv12.cpp b/Userland/Libraries/LibTLS/TLSv12.cpp index ff372f308f..059da14cde 100644 --- a/Userland/Libraries/LibTLS/TLSv12.cpp +++ b/Userland/Libraries/LibTLS/TLSv12.cpp @@ -348,7 +348,7 @@ Singleton DefaultRootCACertificates::s_the; DefaultRootCACertificates::DefaultRootCACertificates() { // FIXME: This might not be the best format, find a better way to represent CA certificates. - auto config = Core::ConfigFile::get_for_system("ca_certs"); + auto config = Core::ConfigFile::open_for_system("ca_certs"); auto now = Core::DateTime::now(); auto last_year = Core::DateTime::create(now.year() - 1); auto next_year = Core::DateTime::create(now.year() + 1); diff --git a/Userland/Services/AudioServer/main.cpp b/Userland/Services/AudioServer/main.cpp index 1eeea8d4e3..d02cf6392b 100644 --- a/Userland/Services/AudioServer/main.cpp +++ b/Userland/Services/AudioServer/main.cpp @@ -17,7 +17,7 @@ int main(int, char**) return 1; } - auto config = Core::ConfigFile::get_for_app("Audio", Core::ConfigFile::AllowWriting::Yes); + auto config = Core::ConfigFile::open_for_app("Audio", Core::ConfigFile::AllowWriting::Yes); if (unveil(config->filename().characters(), "rwc") < 0) { perror("unveil"); return 1; diff --git a/Userland/Services/KeyboardPreferenceLoader/main.cpp b/Userland/Services/KeyboardPreferenceLoader/main.cpp index 2e8c749ee8..17413ef1a3 100644 --- a/Userland/Services/KeyboardPreferenceLoader/main.cpp +++ b/Userland/Services/KeyboardPreferenceLoader/main.cpp @@ -19,7 +19,7 @@ int main() return 1; } - auto keyboard_settings_config = Core::ConfigFile::get_for_app("KeyboardSettings"); + auto keyboard_settings_config = Core::ConfigFile::open_for_app("KeyboardSettings"); if (unveil("/bin/keymap", "x") < 0) { perror("unveil /bin/keymap"); diff --git a/Userland/Services/LaunchServer/main.cpp b/Userland/Services/LaunchServer/main.cpp index 0958d13b29..1998ea243d 100644 --- a/Userland/Services/LaunchServer/main.cpp +++ b/Userland/Services/LaunchServer/main.cpp @@ -20,7 +20,7 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv) auto launcher = LaunchServer::Launcher(); launcher.load_handlers(); - launcher.load_config(Core::ConfigFile::get_for_app("LaunchServer")); + launcher.load_config(Core::ConfigFile::open_for_app("LaunchServer")); if (pledge("stdio accept rpath proc exec", nullptr) < 0) { perror("pledge"); diff --git a/Userland/Services/LookupServer/LookupServer.cpp b/Userland/Services/LookupServer/LookupServer.cpp index 0db8d80987..b27b0b1214 100644 --- a/Userland/Services/LookupServer/LookupServer.cpp +++ b/Userland/Services/LookupServer/LookupServer.cpp @@ -37,7 +37,7 @@ LookupServer::LookupServer() VERIFY(s_the == nullptr); s_the = this; - auto config = Core::ConfigFile::get_for_system("LookupServer"); + auto config = Core::ConfigFile::open_for_system("LookupServer"); dbgln("Using network config file at {}", config->filename()); m_nameservers = config->read_entry("DNS", "Nameservers", "1.1.1.1,1.0.0.1").split(','); diff --git a/Userland/Services/SystemServer/main.cpp b/Userland/Services/SystemServer/main.cpp index cc37f19a5c..e56c4c5af5 100644 --- a/Userland/Services/SystemServer/main.cpp +++ b/Userland/Services/SystemServer/main.cpp @@ -215,7 +215,7 @@ int main(int, char**) // Read our config and instantiate services. // This takes care of setting up sockets. NonnullRefPtrVector services; - auto config = Core::ConfigFile::get_for_system("SystemServer"); + auto config = Core::ConfigFile::open_for_system("SystemServer"); for (auto name : config->groups()) { auto service = Service::construct(*config, name); if (service->is_enabled()) diff --git a/Userland/Services/Taskbar/TaskbarWindow.cpp b/Userland/Services/Taskbar/TaskbarWindow.cpp index 1795cc8589..431de783e4 100644 --- a/Userland/Services/Taskbar/TaskbarWindow.cpp +++ b/Userland/Services/Taskbar/TaskbarWindow.cpp @@ -116,7 +116,7 @@ void TaskbarWindow::create_quick_launch_bar() quick_launch_bar.layout()->set_spacing(0); quick_launch_bar.set_frame_thickness(0); - auto config = Core::ConfigFile::get_for_app("Taskbar"); + auto config = Core::ConfigFile::open_for_app("Taskbar"); constexpr const char* quick_launch = "QuickLaunch"; // FIXME: Core::ConfigFile does not keep the order of the entries. diff --git a/Userland/Utilities/run-tests.cpp b/Userland/Utilities/run-tests.cpp index d7a1f41f58..cd00f4075d 100644 --- a/Userland/Utilities/run-tests.cpp +++ b/Userland/Utilities/run-tests.cpp @@ -329,7 +329,7 @@ int main(int argc, char** argv) return 1; } - auto config = config_file.is_empty() ? Core::ConfigFile::get_for_app("Tests") : Core::ConfigFile::open(config_file); + auto config = config_file.is_empty() ? Core::ConfigFile::open_for_app("Tests") : Core::ConfigFile::open(config_file); if (config->num_groups() == 0) warnln("Empty configuration file ({}) loaded!", config_file.is_empty() ? "User config for Tests" : config_file.characters());