How to use WSL as default terminal in WebStorm or any other JetBrains' products?

I am currently using Windows 10 with WSL Ubuntu 18.04 installed. I am trying to use WSL as the default terminal in WebStorm however, I am able to use the bash from WSL but the default directory would not be set to the default project location.

Does anyone know how to set this up correctly?


After a bit of search on google found a solution to my question.

First figure out the default wsl with the command:

C:\Windows\System32\wslconfig /list

Windows Subsystem for Linux Distributions:
Ubuntu-18.04 
Legacy (Default)

then I set the default to Ubuntu-18.04 by

C:\Windows\System32\wslconfig /setdefault Ubuntu-18.04

Finally set the terminal path in Webstrom settings>tools>terminal to

C:\Windows\System32\wsl.exe

Now open the terminal it is correctly move the current directory to the /mnt/c/blah/blah


Set:
Settings > Tools > Terminal > Shell path

Equal to:

"C:\Users\<username>\AppData\Local\Microsoft\WindowsApps\ubuntu.exe" run

change setting


The result is:

resulting terminal