fix: use getuser() syscall for determining username rather than session.toml hack

This commit is contained in:
2026-04-01 11:44:13 +02:00
parent 8e63b75fe7
commit 6276f8b162
8 changed files with 40 additions and 67 deletions
+6 -6
View File
@@ -519,11 +519,11 @@ bool config::unset(toml::Doc* doc, const char* key);
### Example
```cpp
auto doc = montauk::config::load("session");
const char* user = doc.get_string("session.username", "guest");
auto doc = montauk::config::load("desktop");
const char* theme = doc.get_string("appearance.theme", "light");
montauk::config::set_string(&doc, "session.theme", "dark");
montauk::config::save("session", &doc);
montauk::config::set_string(&doc, "appearance.theme", "dark");
montauk::config::save("desktop", &doc);
```
---
@@ -543,8 +543,8 @@ bool user::change_password(const char* username, const char* new_password);
void user::set_session(const char* username); // Log in
void user::clear_session(); // Log out
bool user::get_session_username(char* buf, int sz); // Get current user
bool user::get_home_dir(char* buf, int sz); // Get user's home directory
bool user::get_session_username(char* buf, int sz); // Get current process user
bool user::get_home_dir(char* buf, int sz); // Get current process home directory
```
---