mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 16:49:54 +00:00
most apps now begin in the correct directory
This commit is contained in:
parent
e3f81bce49
commit
50154a23cb
Notes:
sideshowbarker
2024-07-19 13:54:06 +09:00
Author: https://github.com/alexispurslane
Commit: 50154a23cb
Pull-request: https://github.com/SerenityOS/serenity/pull/118
Reviewed-by: https://github.com/awesomekling
7 changed files with 34 additions and 14 deletions
17
LibCore/CUserInfo.cpp
Normal file
17
LibCore/CUserInfo.cpp
Normal file
|
@ -0,0 +1,17 @@
|
|||
#include "CUserInfo.h"
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <pwd.h>
|
||||
|
||||
const char *get_current_user_home_path() {
|
||||
if (auto* home_env = getenv("HOME")) {
|
||||
return home_env;
|
||||
} else {
|
||||
auto d = "/";
|
||||
uid_t uid = getuid();
|
||||
if (auto* pwd = getpwuid(uid))
|
||||
return pwd->pw_dir;
|
||||
else
|
||||
return d;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue