Improve the OS.get_environment()/OS.set_environment() documentation

(cherry picked from commit 355803db1b)
This commit is contained in:
Hugo Locurcio 2021-02-25 15:12:43 +01:00 committed by Rémi Verschelde
parent 3b4dd88e56
commit b2725cb4b9
2 changed files with 12 additions and 9 deletions

View file

@ -1347,9 +1347,9 @@ void _OS::_bind_methods() {
ClassDB::bind_method(D_METHOD("shell_open", "uri"), &_OS::shell_open); ClassDB::bind_method(D_METHOD("shell_open", "uri"), &_OS::shell_open);
ClassDB::bind_method(D_METHOD("get_process_id"), &_OS::get_process_id); ClassDB::bind_method(D_METHOD("get_process_id"), &_OS::get_process_id);
ClassDB::bind_method(D_METHOD("get_environment", "environment"), &_OS::get_environment); ClassDB::bind_method(D_METHOD("get_environment", "variable"), &_OS::get_environment);
ClassDB::bind_method(D_METHOD("set_environment", "environment", "value"), &_OS::set_environment); ClassDB::bind_method(D_METHOD("set_environment", "variable", "value"), &_OS::set_environment);
ClassDB::bind_method(D_METHOD("has_environment", "environment"), &_OS::has_environment); ClassDB::bind_method(D_METHOD("has_environment", "variable"), &_OS::has_environment);
ClassDB::bind_method(D_METHOD("get_name"), &_OS::get_name); ClassDB::bind_method(D_METHOD("get_name"), &_OS::get_name);
ClassDB::bind_method(D_METHOD("get_cmdline_args"), &_OS::get_cmdline_args); ClassDB::bind_method(D_METHOD("get_cmdline_args"), &_OS::get_cmdline_args);

View file

@ -222,10 +222,11 @@
<method name="get_environment" qualifiers="const"> <method name="get_environment" qualifiers="const">
<return type="String"> <return type="String">
</return> </return>
<argument index="0" name="environment" type="String"> <argument index="0" name="variable" type="String">
</argument> </argument>
<description> <description>
Returns an environment variable. Returns the value of an environment variable. Returns an empty string if the environment variable doesn't exist.
[b]Note:[/b] Double-check the casing of [code]variable[/code]. Environment variable names are case-sensitive on all platforms except Windows.
</description> </description>
</method> </method>
<method name="get_executable_path" qualifiers="const"> <method name="get_executable_path" qualifiers="const">
@ -643,10 +644,11 @@
<method name="has_environment" qualifiers="const"> <method name="has_environment" qualifiers="const">
<return type="bool"> <return type="bool">
</return> </return>
<argument index="0" name="environment" type="String"> <argument index="0" name="variable" type="String">
</argument> </argument>
<description> <description>
Returns [code]true[/code] if an environment variable exists. Returns [code]true[/code] if the environment variable with the name [code]variable[/code] exists.
[b]Note:[/b] Double-check the casing of [code]variable[/code]. Environment variable names are case-sensitive on all platforms except Windows.
</description> </description>
</method> </method>
<method name="has_feature" qualifiers="const"> <method name="has_feature" qualifiers="const">
@ -917,12 +919,13 @@
<method name="set_environment" qualifiers="const"> <method name="set_environment" qualifiers="const">
<return type="bool"> <return type="bool">
</return> </return>
<argument index="0" name="environment" type="String"> <argument index="0" name="variable" type="String">
</argument> </argument>
<argument index="1" name="value" type="String"> <argument index="1" name="value" type="String">
</argument> </argument>
<description> <description>
Change the value of an environment variable. Sets the value of the environment variable [code]variable[/code] to [code]value[/code]. 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 [code]variable[/code]. Environment variable names are case-sensitive on all platforms except Windows.
</description> </description>
</method> </method>
<method name="set_icon"> <method name="set_icon">