Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access files in WSL filesystem by exe in Windows' filesystem #7691

Closed
1 of 2 tasks
Joker2387089590 opened this issue Nov 14, 2021 · 6 comments
Closed
1 of 2 tasks

Access files in WSL filesystem by exe in Windows' filesystem #7691

Joker2387089590 opened this issue Nov 14, 2021 · 6 comments

Comments

@Joker2387089590
Copy link

Version

Microsoft Windows [Version 10.0.19043.1348]

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

5.4.72

Distro Version

Ubuntu 20.04

Other Software

notepad.exe or any exe located on Windows

Repro Steps

  1. Open terminal and run wsl.exe
  2. Write a simple C source file: echo 'int main() { return 0; }' > ~/main.c
  3. run cd ~ && notepad.exe ~/main.c, OK
  4. run cd /mnt/c && notepad.exe ~/main.c, notepad can't find the file

Expected Behavior

The exe files (in Windows) will work fine when the current working directory is on both Windows and WSL.

Actual Behavior

Only the working directory is on Linux that exe files can find the files in WSL's filesystem.

Diagnostic Logs

No response

@Biswa96
Copy link

Biswa96 commented Nov 14, 2021

That ~/main.c path has to be converted to Win style first. i.e. this may work notepad.exe $(wslpath -w ~/main.c)

@Joker2387089590
Copy link
Author

That ~/main.c path has to be converted to Win style first. i.e. this may work notepad.exe $(wslpath -w ~/main.c)

Yes, it works. But actually, I'm using CMake to compile it. The path sent to compiler is generated by CMake and hard to modify it.

@Biswa96
Copy link

Biswa96 commented Nov 14, 2021

CMake where?

@Joker2387089590
Copy link
Author

CMake where?
WSL /usr/bin

@Biswa96
Copy link

Biswa96 commented Nov 14, 2021

CMake in Linux environment can access ~/main.c without any path conversion.

If the CMake in Windows environment you need something like in VSCode or ssh.

@Joker2387089590
Copy link
Author

CMake in Linux environment can access ~/main.c without any path conversion.

If the CMake in Windows environment you need something like in VSCode or ssh.

Yes, I built the project successfully. Thank you!
Howerver, the problem in issue seems to be not solved... It didn't appear When I used WSL1. So I guess that maybe the exe is executed by Windows directly, in order to optimize the speed of accessing files.

@microsoft microsoft locked and limited conversation to collaborators Nov 15, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants