diff --git a/etc/profile.d/codespace.sh b/etc/profile.d/codespace.sh index ad72788e..e8b1a684 100644 --- a/etc/profile.d/codespace.sh +++ b/etc/profile.d/codespace.sh @@ -1,6 +1,12 @@ # If not root if [ "$(whoami)" != "root" ]; then + # Check if running locally and set $RepositoryName if not already set + if [[ "$CODESPACES" != "true" && -z "$RepositoryName" ]]; then + export RepositoryName=$(ls -1t --color=never /workspaces | tail -1 | sed 's:/*$::') + export LOCAL_WORKSPACE_FOLDER="/workspaces/$RepositoryName" + fi + # Rewrites URLs of the form http://HOST:PORT as https://$CODESPACE_NAME.app.github.dev:PORT _hostname() {