Allow wslpath to generate windows paths when file does not exist on the unix file system
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 33.7k
- Forks
- 1.8k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 116
Description
Is your feature request related to a problem? Please describe.
I would like to generate paths to files that do not yet exist. I want to do this so I can use compilers and file generators (such as MSVC) to create files on my linux partition. For example, when specifying the output such as OBJ and EXE files they do not exist yet and I would like to generate a path for passing as parameters to the compiler and or linker.
What currently happens is this:
stuartf@Foiegras:~$ echo $(wslpath -w ./test.obj)
wslpath: ./test.obj: No such file or directory
Describe the solution you'd like
I would like to create a path to ./test.obj when ./test.obj does not exist. A simple workaround by hand demonstrates what I would like to happen:
stuartf@Foiegras:~$ echo $(wslpath -w ./)\\test.obj
\\wsl$\Ubuntu-18.04\home\stuartf\test.obj
In the case above, I know the file doesn't exist. But in more complicated cases such as creating a new series of embedded directory paths or within an automated call this would make interop a bit more pleasant.
Describe alternatives you've considered
At the moment I'm considering writing a shell script to check for the existence of the file first. If it doesn't exist I'll need to backup the directory chain translating manually until I find the root of the first existing node. My bash scripting will need some improvement to pull this off, but it seems pretty doable. Just less than ideal.
Additional context
This would be great for file generating tools that require paths to the new outputs.
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 locating the wslpath implementation and its existing path-conversion tests, then reproduce the ./test.obj example. Done means nonexistent files, including paths with newly created directory components, convert to Windows paths while existing-path behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, linux
- Domain
- cli, operating-systems
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100