mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 06:18:59 +00:00
LibCore: Add StandardPaths thing to retrieve various standard locations
Fixes #1853.
This commit is contained in:
parent
3b434068eb
commit
c45e16f605
Notes:
sideshowbarker
2024-07-19 07:27:23 +09:00
Author: https://github.com/awesomekling
Commit: c45e16f605
10 changed files with 51 additions and 25 deletions
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue