mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
LibCore: Add StandardPaths thing to retrieve various standard locations
Fixes #1853.
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibCore/ConfigFile.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/UserInfo.h>
|
||||
#include <LibCore/StandardPaths.h>
|
||||
#include <pwd.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
@@ -36,9 +36,7 @@ namespace Core {
|
||||
|
||||
NonnullRefPtr<ConfigFile> ConfigFile::get_for_app(const String& app_name)
|
||||
{
|
||||
String home_path = get_current_user_home_path();
|
||||
if (home_path == "/")
|
||||
home_path = String::format("/tmp");
|
||||
String home_path = StandardPaths::home_directory();
|
||||
auto path = String::format("%s/%s.ini", home_path.characters(), app_name.characters());
|
||||
return adopt(*new ConfigFile(path));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user