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

Add set_environment() method in OS #1846

Closed
YakoYakoYokuYoku opened this issue Nov 16, 2020 · 1 comment
Closed

Add set_environment() method in OS #1846

YakoYakoYokuYoku opened this issue Nov 16, 2020 · 1 comment
Milestone

Comments

@YakoYakoYokuYoku
Copy link

YakoYakoYokuYoku commented Nov 16, 2020

Describe the project you are working on:
A Cargo plugin for the editor.

Describe the problem or limitation you are having in your project:
Trying to set an environment variable in Godot without using the system shell is impossible, something that might not be desired in some cases.

Describe the feature / enhancement and how it helps to overcome the problem or limitation:
Adding a void set_evironment(String env_var, String value) method to the OS class provides a simpler and cleaner way to set the variables.

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
As environment variables have strings as their values the set_environment() method must take the variable (env_var) and the value (value). Then assigns value to env_var. E.g.:

OS.set_environment("FOO", "bar")

If this enhancement will not be used often, can it be worked around with a few lines of script?:

OS.execute(<"export" for UNIX, "set" for Windows>, ["FOO=bar"])

Is there a reason why this should be core and not an add-on in the asset library?:
Considering many programming languages provides the method/functionality in their standard libraries and Godot has the get_environment() method, this proposal brings a solution to the problem without any workarounds.

@YakoYakoYokuYoku
Copy link
Author

@Calinou this was accepted in PR godotengine/godot/pull/46413.

@Calinou Calinou closed this as completed Mar 14, 2021
@Calinou Calinou added this to the 3.2 milestone Mar 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants