diff options
author | Bastiaan Olij <mux213@gmail.com> | 2021-02-25 22:20:13 +1100 |
---|---|---|
committer | Bastiaan Olij <mux213@gmail.com> | 2021-02-25 23:36:14 +1100 |
commit | 4c8f5b998faa2fdf72e52fa434fdd4ad84bfb2ca (patch) | |
tree | 29831d8e97555f574c249a00879ac1446f6cc71e | |
parent | 2adacd751c9f83f0dbbedcd2d4ce112104e09513 (diff) |
Expose set_environment to GDScript
-rw-r--r-- | core/core_bind.cpp | 5 | ||||
-rw-r--r-- | core/core_bind.h | 1 | ||||
-rw-r--r-- | doc/classes/OS.xml | 11 |
3 files changed, 17 insertions, 0 deletions
diff --git a/core/core_bind.cpp b/core/core_bind.cpp index 0da6680a7b..457a110054 100644 --- a/core/core_bind.cpp +++ b/core/core_bind.cpp @@ -276,6 +276,10 @@ String _OS::get_environment(const String &p_var) const { return OS::get_singleton()->get_environment(p_var); } +bool _OS::set_environment(const String &p_var, const String &p_value) const { + return OS::get_singleton()->set_environment(p_var, p_value); +} + String _OS::get_name() const { return OS::get_singleton()->get_name(); } @@ -712,6 +716,7 @@ void _OS::_bind_methods() { 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("set_environment", "environment", "value"), &_OS::set_environment); ClassDB::bind_method(D_METHOD("has_environment", "environment"), &_OS::has_environment); ClassDB::bind_method(D_METHOD("get_name"), &_OS::get_name); diff --git a/core/core_bind.h b/core/core_bind.h index 8a4885b82b..0cfe9bdb8b 100644 --- a/core/core_bind.h +++ b/core/core_bind.h @@ -172,6 +172,7 @@ 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; String get_name() const; Vector<String> get_cmdline_args(); diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index f6602d5f4d..6a59f24ac2 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -501,6 +501,17 @@ [b]Note:[/b] This method is implemented on Android. </description> </method> + <method name="set_environment" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="environment" type="String"> + </argument> + <argument index="1" name="value" type="String"> + </argument> + <description> + Change the value of an environment variable. + </description> + </method> <method name="set_thread_name"> <return type="int" enum="Error"> </return> |