LibCore: Add ConfigFile::get_for_lib()

This commit is contained in:
AnotherTest 2020-08-17 19:13:15 +04:30 committed by Andreas Kling
parent 1176865276
commit afbeb8f977
Notes: sideshowbarker 2024-07-19 03:28:01 +09:00
2 changed files with 9 additions and 0 deletions

View file

@ -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();

View file

@ -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);