From 347553ac5c874cd0644e7ef60ebe0a549306afc5 Mon Sep 17 00:00:00 2001 From: Rongxin Liu Date: Thu, 13 Jun 2024 11:02:17 -0400 Subject: [PATCH] create env var for offline codespace --- etc/profile.d/codespace.sh | 6 ++++++ 1 file changed, 6 insertions(+) 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() {