microsoft / microsoft/vscode-remote-release

User home directory variable (Containers)

Open
#3,567 2 comments 28 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

containers feature-request
Dominant language
Dockerfile
Stars
4.2k
Forks
470
Avg merge
1d 1h
Merged PRs (30d)
1

Description

I would like to request that VS Code Remote - Containers abstract away the platform-specific absolute path to the user home directory within a devcontainer.json variable. The current examples in the docs reference both the *nix and Windows environment variables:

"remoteEnv": { "LOCAL_USER_PATH": "${localEnv:HOME}${localEnv:USERPROFILE}" }

However, this approach is not foolproof, as it makes the assumption that HOME is always unset on Windows. When opening VS Code via Git Bash on Windows, for example, that assumption does not hold true, causing the value of the LOCAL_USER_PATH environment variable above to be the concatenation of the *nix and Windows absolute paths: /c/Users/jdoeC:\\Users\\jdoe

Instead, I would like VS Code Remote - Containers to provide a new built-in variable such as ${localUserHome} that always contains the absolute path to the user home directory appropriate to the platform regardless of shell or environment:

  • *nix: /home/jdoe
  • Mac OS: /Users/jdoe
  • Windows: %SYSTEMDRIVE%\Users\jdoe

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Variables in devcontainer.json reference and the existing remoteEnv example. Trace how variable substitution is handled for devcontainer.json, then verify that a new local-home variable resolves to the platform-appropriate path under Unix, macOS, Windows, and Git Bash; the issue is done when those cases no longer require concatenating HOME and USERPROFILE.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, vscode
Domain
developer-experience, devops
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.