Use WSLENV to append to an environment variable
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 33.7k
- Forks
- 1.8k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 116
Description
It would be nice to be able to use WSLENV to append to environment variables rather than replace them.
My main motivation is running a Windows executable in a Linux shell. I can do this now but I have to make sure my PATH contains all the Windows paths that are needed before I do a
export WSLENV=PATH/lw
I'm mainy adding directories to the PATH containing DLLs needed by the executable I am running. I would much rather set my LD_LIBRARY_PATH, which is the natural thing for Linux, in my shell script and then get WSLENV to append it to the Windows PATH, so maybe something like
export WSLENV=PATH+LD_LIBRARY_PATH/lw
This would mean append the Linux LD_LIBRARY_PATH environment variable to the existing Windows PATH environment variable and convert the paths in the LD_LIBRARY_PATH while doing it. The Linux PATH environment variable would not be exported.
So if my LD_LIBRARY_PATH was /mnt/c/Users/davidhunter2/bin then C:\Users\davidhunter22\bin would be appended to the Windows PATH whatever that happened to already be. Obviously with a ';' separator if needed.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the WSLENV=PATH/lw example and review how WSLENV currently handles environment-variable replacement and path conversion. The change would need to define and implement append semantics for a Linux variable such as LD_LIBRARY_PATH, including Windows PATH separators and preserving the existing Windows value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, linux
- Domain
- operating-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100