You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GodotEnv currently only sets the GODOT environment variable (along with changes to PATH) inside the ".bashrc" file. However, we found out through Discord discussion that on an Arch-based OS, VSCode will not read environment variables correctly unless they are set in user's ".bash_profile" file. Setting the variable in both places would allow Arch-based distros to work out of the box like the rest.
The text was updated successfully, but these errors were encountered:
jolexxa
changed the title
Set GODOT environment variable in both ".bashrc" and ".bash_profile" shell configuration files
Set GODOT environment variable in both ".bashrc" and ".bash_profile" shell configuration files on Unix
Jun 10, 2024
Hi, ~/.bash_profile ~/.profile are called by login shells, the one that starts when you log in to your system and only at that moment (generally). ~/.bashrc is called by interactive, non-login shell, when you open a Terminal application (GNOME Terminal, Konsole).
However, we found out through Discord discussion that on an Arch-based OS, VSCode will not read environment variables correctly unless they are set in user's ".bash_profile" file.
Can you describe better your situation, maybe with some example? From my tests (Ubuntu), VSCode seems to source a login shell at startup, and when you open an integrated shell it's an interactive non-login shell:
Put a echo at the end of my ~/.bashrc to show that it's been called:
I think it's worth a look into the vscode's setting "terminal.integrated.profiles.linux" and see if it specifies some args for the shell that can be affecting it's initialization. https://code.visualstudio.com/docs/terminal/profiles
But this can vary, as some distros sources ~/.bashrc from ~/.profile per example (it's my case). So, this means that a bash login shell can source ... -> ~/.profile -> ~/.bashrc.
As we can see, the shell process initialization is tricky and can vary per shell/distro. One interesting approach to guarantee that the PATH modification is happening, independent of how the shell is being called, it's to define some separated script that checks if the PATH was already patched, if not patch it. This script would be sourced at multiple shell's startup files. It's the approach that rust's cargo tool took:
#!/bin/sh# rustup shell setup# affix colons on either side of $PATH to simplify matchingcase":${PATH}:"in*:"$HOME/.cargo/bin":*)
;;
*)
# Prepending path in case a system-installed rustc needs to be overriddenexport PATH="$HOME/.cargo/bin:$PATH"
;;
esac
GodotEnv currently only sets the GODOT environment variable (along with changes to PATH) inside the ".bashrc" file. However, we found out through Discord discussion that on an Arch-based OS, VSCode will not read environment variables correctly unless they are set in user's ".bash_profile" file. Setting the variable in both places would allow Arch-based distros to work out of the box like the rest.
The text was updated successfully, but these errors were encountered: