mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-24 21:45:20 +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 {
|
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)
|
NonnullRefPtr<ConfigFile> ConfigFile::get_for_app(const String& app_name)
|
||||||
{
|
{
|
||||||
String directory = StandardPaths::config_directory();
|
String directory = StandardPaths::config_directory();
|
||||||
|
|
|
@ -37,6 +37,7 @@ namespace Core {
|
||||||
|
|
||||||
class ConfigFile : public RefCounted<ConfigFile> {
|
class ConfigFile : public RefCounted<ConfigFile> {
|
||||||
public:
|
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_app(const String& app_name);
|
||||||
static NonnullRefPtr<ConfigFile> get_for_system(const String& app_name);
|
static NonnullRefPtr<ConfigFile> get_for_system(const String& app_name);
|
||||||
static NonnullRefPtr<ConfigFile> open(const String& path);
|
static NonnullRefPtr<ConfigFile> open(const String& path);
|
||||||
|
|
Loading…
Add table
Reference in a new issue