summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Libraries/LibCore/ConfigFile.cpp8
-rw-r--r--Libraries/LibCore/ConfigFile.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/Libraries/LibCore/ConfigFile.cpp b/Libraries/LibCore/ConfigFile.cpp
index a36d99d3bd..267513e9da 100644
--- a/Libraries/LibCore/ConfigFile.cpp
+++ b/Libraries/LibCore/ConfigFile.cpp
@@ -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();
diff --git a/Libraries/LibCore/ConfigFile.h b/Libraries/LibCore/ConfigFile.h
index 6a71ff9b88..24865a0e48 100644
--- a/Libraries/LibCore/ConfigFile.h
+++ b/Libraries/LibCore/ConfigFile.h
@@ -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);