mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibCore: Add ConfigFile::get_for_lib()
This commit is contained in:
parent
1176865276
commit
afbeb8f977
Notes:
sideshowbarker
2024-07-19 03:28:01 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/afbeb8f977b Pull-request: https://github.com/SerenityOS/serenity/pull/3193
2 changed files with 9 additions and 0 deletions
|
@ -34,6 +34,14 @@
|
|||
|
||||
namespace Core {
|
||||
|
||||
NonnullRefPtr<ConfigFile> ConfigFile::get_for_lib(const String& lib_name)
|
||||
{
|
||||
String directory = StandardPaths::config_directory();
|
||||
auto path = String::format("%s/lib/%s.ini", directory.characters(), lib_name.characters());
|
||||
|
||||
return adopt(*new ConfigFile(path));
|
||||
}
|
||||
|
||||
NonnullRefPtr<ConfigFile> ConfigFile::get_for_app(const String& app_name)
|
||||
{
|
||||
String directory = StandardPaths::config_directory();
|
||||
|
|
|
@ -37,6 +37,7 @@ namespace Core {
|
|||
|
||||
class ConfigFile : public RefCounted<ConfigFile> {
|
||||
public:
|
||||
static NonnullRefPtr<ConfigFile> get_for_lib(const String& lib_name);
|
||||
static NonnullRefPtr<ConfigFile> get_for_app(const String& app_name);
|
||||
static NonnullRefPtr<ConfigFile> get_for_system(const String& app_name);
|
||||
static NonnullRefPtr<ConfigFile> open(const String& path);
|
||||
|
|
Loading…
Reference in a new issue