diff options
author | Andreas Kling <kling@serenityos.org> | 2020-08-05 17:18:59 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-05 17:40:47 +0200 |
commit | bc615572a9740410dfdcc34fd51ec270cbac846b (patch) | |
tree | 5ca1559d30c8f48ac090a4a4a69ebeaa09d58aff /Libraries/LibCore | |
parent | 7b15c85ff5ef8cad674bd64871cb8435a255cb8f (diff) | |
download | serenity-bc615572a9740410dfdcc34fd51ec270cbac846b.zip |
LibCore+Base: Move user-specific config files to $HOME/.config
Diffstat (limited to 'Libraries/LibCore')
-rw-r--r-- | Libraries/LibCore/ConfigFile.cpp | 4 | ||||
-rw-r--r-- | Libraries/LibCore/StandardPaths.cpp | 8 | ||||
-rw-r--r-- | Libraries/LibCore/StandardPaths.h | 1 |
3 files changed, 11 insertions, 2 deletions
diff --git a/Libraries/LibCore/ConfigFile.cpp b/Libraries/LibCore/ConfigFile.cpp index dcc3591478..a36d99d3bd 100644 --- a/Libraries/LibCore/ConfigFile.cpp +++ b/Libraries/LibCore/ConfigFile.cpp @@ -36,8 +36,8 @@ namespace Core { NonnullRefPtr<ConfigFile> ConfigFile::get_for_app(const String& app_name) { - String home_path = StandardPaths::home_directory(); - auto path = String::format("%s/%s.ini", home_path.characters(), app_name.characters()); + String directory = StandardPaths::config_directory(); + auto path = String::format("%s/%s.ini", directory.characters(), app_name.characters()); return adopt(*new ConfigFile(path)); } diff --git a/Libraries/LibCore/StandardPaths.cpp b/Libraries/LibCore/StandardPaths.cpp index c73e16461b..3ed9197835 100644 --- a/Libraries/LibCore/StandardPaths.cpp +++ b/Libraries/LibCore/StandardPaths.cpp @@ -61,6 +61,14 @@ String StandardPaths::downloads_directory() return LexicalPath::canonicalized_path(builder.to_string()); } +String StandardPaths::config_directory() +{ + StringBuilder builder; + builder.append(home_directory()); + builder.append("/.config"); + return LexicalPath::canonicalized_path(builder.to_string()); +} + String StandardPaths::tempfile_directory() { return "/tmp"; diff --git a/Libraries/LibCore/StandardPaths.h b/Libraries/LibCore/StandardPaths.h index 30ebac7c27..51346250c2 100644 --- a/Libraries/LibCore/StandardPaths.h +++ b/Libraries/LibCore/StandardPaths.h @@ -36,6 +36,7 @@ public: static String desktop_directory(); static String downloads_directory(); static String tempfile_directory(); + static String config_directory(); }; } |