diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-01-16 14:26:14 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-01-16 16:39:44 +0100 |
commit | 818a9e99a4bdbc6e3b12636ceff36759a778e848 (patch) | |
tree | dae35a70787bd6795f9738d54b8fe5008ff2ecac /doc/classes | |
parent | 04a39ecd846f40ac1049b699291f28b2f08e2185 (diff) |
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
Diffstat (limited to 'doc/classes')
-rw-r--r-- | doc/classes/OS.xml | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index 6dab7b4ebe..1bc81ffb42 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -592,12 +592,12 @@ </description> </method> <method name="set_environment" qualifiers="const"> - <return type="bool" /> + <return type="void" /> <param index="0" name="variable" type="String" /> <param index="1" name="value" type="String" /> <description> Sets the value of the environment variable [param variable] to [param value]. The environment variable will be set for the Godot process and any process executed with [method execute] after running [method set_environment]. The environment variable will [i]not[/i] persist to processes run after the Godot process was terminated. - [b]Note:[/b] Double-check the casing of [param variable]. Environment variable names are case-sensitive on all platforms except Windows. + [b]Note:[/b] Environment variable names are case-sensitive on all platforms except Windows. The [param variable] name cannot be empty or include the [code]=[/code] character. On Windows, there is a 32767 characters limit for the combined length of [param variable], [param value], and the [code]=[/code] and null terminator characters that will be registered in the environment block. </description> </method> <method name="set_restart_on_exit"> @@ -637,6 +637,14 @@ [b]Note:[/b] This method is implemented on Android, iOS, Web, Linux, macOS and Windows. </description> </method> + <method name="unset_environment" qualifiers="const"> + <return type="void" /> + <param index="0" name="variable" type="String" /> + <description> + Removes the environment [param variable] from the current environment, if it exists. The environment variable will be removed for the Godot process and any process executed with [method execute] after running [method unset_environment]. The removal of the environment variable will [i]not[/i] persist to processes run after the Godot process was terminated. + [b]Note:[/b] Environment variable names are case-sensitive on all platforms except Windows. The [param variable] name cannot be empty or include the [code]=[/code] character. + </description> + </method> </methods> <members> <member name="low_processor_usage_mode" type="bool" setter="set_low_processor_usage_mode" getter="is_in_low_processor_usage_mode" default="false"> |