OS: Add unset_environment, better validate input

Instead of returning an undocumented boolean error code, we do the
validation checks that should ensure a successful result.

Based on:
- https://linux.die.net/man/3/setenv
- https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setenvironmentvariable
This commit is contained in:
Rémi Verschelde
2023-01-16 14:26:14 +01:00
parent 04a39ecd84
commit 818a9e99a4
8 changed files with 51 additions and 17 deletions

View File

@ -162,7 +162,8 @@ public:
bool has_environment(const String &p_var) const;
String get_environment(const String &p_var) const;
bool set_environment(const String &p_var, const String &p_value) const;
void set_environment(const String &p_var, const String &p_value) const;
void unset_environment(const String &p_var) const;
String get_name() const;
String get_distribution_name() const;