Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.2] Expose set_environment to GDScript #46413

Merged
merged 1 commit into from
Feb 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions core/bind/core_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,11 @@ 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();
Expand Down Expand Up @@ -1343,6 +1348,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);
Expand Down
1 change: 1 addition & 0 deletions core/bind/core_bind.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ class _OS : public Object {

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();
Expand Down
11 changes: 11 additions & 0 deletions doc/classes/OS.xml
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,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_icon">
<return type="void">
</return>
Expand Down