Skip to content

Support environment variable expansion in File Open dialog - #1007

Open
pranav sirnapalli (pranav-sirnapalli) wants to merge 1 commit into
microsoft:mainfrom
pranav-sirnapalli:feature/499-open-menu-env-vars
Open

pranav sirnapalli (pranav-sirnapalli) wants to merge 1 commit into
microsoft:mainfrom
pranav-sirnapalli:feature/499-open-menu-env-vars

Conversation

@pranav-sirnapalli

Copy link
Copy Markdown

Summary

Adds support for environment-variable and home-directory expansion in the File → Open dialog.

Fixes #499.

Changes

  • Support %NAME% environment variables on Windows and $NAME on Unix, along with leading ~ home-directory expansion.
  • Expand manually entered paths before resolving them against the current directory, allowing both file opening and directory navigation.
  • Preserve literal filenames selected from the file picker, even when they contain environment-variable syntax.
  • Leave ordinary paths, unresolved variables, and Save As behavior unchanged.
  • Add unit and regression tests covering path expansion, directory navigation, file selection, and Save As behavior.

The implementation uses the Rust standard library and introduces no new dependencies.

Testing

Automated validation

  • cargo test -p edit — passed (107 tests, 1 ignored).
  • cargo +nightly test -p edit --all-targets — passed (104 unit tests, 1 ignored, plus benchmark targets).
  • cargo +nightly fmt --all -- --check — passed.
  • cargo +nightly clippy --all-features --all-targets -- --no-deps --deny warnings — passed.
  • cargo build --release — passed.

Manual validation on Ubuntu WSL

  • Opened a file using a $VARIABLE path.
  • Navigated to the home directory using ~.
  • Opened an ordinary relative file path.
  • Selected a literal filename containing $HOME and %WINDIR% without unintended expansion.

Known test limitation

The all-features test configuration produces an out-of-memory failure in the existing arena allocator when the single-threaded feature is enabled. I reproduced the same failure in base64::tests::test_basic on an unmodified checkout of main (commit b7f8322). Standard-feature tests pass.

Native Windows UI behavior has not yet been manually tested; Windows-specific validation remains for CI and review.

@pranav-sirnapalli

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A way to type paths using Environment Variables in the open menu

1 participant