1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 23:27:42 +00:00

most apps now begin in the correct directory

This commit is contained in:
Christopher Dumas 2019-05-25 16:58:22 -07:00 committed by Andreas Kling
parent e3f81bce49
commit 50154a23cb
7 changed files with 34 additions and 14 deletions

17
LibCore/CUserInfo.cpp Normal file
View 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;
}
}