Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to move workspace(a simple project) from windows file system (/mnt/) to linux (~/home)

I am developing a Django project (nothing) and trying to use using WSL2.

so if I use the Ubuntu Terminal from Windows to create a project and try running it in VScode, I got this little message,

enter image description here

I just don't know how to do that at all,

it's the first time I tried to use WSL2 (which is awesome), if someone could help, thank you very much.

like image 498
taha maatof Avatar asked Mar 22 '21 21:03

taha maatof


People also ask

Where should I save files on WSL?

If you're working in a Windows command line (PowerShell, Command Prompt), store your files in the Windows file system. For example, when storing your WSL project files: Use the Linux file system root directory: \\wsl$\Ubuntu\home\<user name>\Project.

How do I transfer files from WSL2 to Windows?

Suppose, create a text file using the “touch” command: Open the File Explorer again to check if the file is created: To copy the file in Windows, right-click on it and select copy: Paste it in the Windows directory where you want to transfer the file.

Where is WSL2 file system?

The WSL2 Filesystem WSL2 changes how everything works under the hood for sharing file systems. For starters, the filesystem is now a virtual hard disk in vhdx format instead of a directory. You can find the vhdx file under %USERPROFILE%\AppData\Local\Packages\CanonicalGroupLimited.


1 Answers

If you have your project in some mounted folder -> linux path starting with /mnt/ e.g. /mnt/c/Users/rasto/Desktop/some_folder/my_project/

When you open VS Code in this directory (via running command code . or opening the VS Code from windows) you get the warning:

This workspace is on the Windows file system (/mnt/). For best performance, we recommend moving the workspace to the Linux file system (~/home).

The solution is easy -> move/copy the project folder to ~/my_project/ directory:

In WSL terminal:

Recursively copy all files from source-path to destination-path and if the folder ~/my_project/ does not exists, it will be created

 cp -R /mnt/c/Users/rasto/Desktop/some_folder/my_project/ ~/my_project

Move to the directory in your terminal

cd ~/my_project

And open VS Code from console with

code .

Note: To open VS Code from terminal you must have installe extension Remote Development extension pack

Note2: To access the linux folder from windows file explorer just right click in VS Code explorer and Reveal in explorer or with the path like: \\wsl$\Ubuntu-18.04\home\rasto\my_projects

like image 76
Rastislav Avatar answered Sep 23 '22 13:09

Rastislav