wslpath icon indicating copy to clipboard operation
wslpath copied to clipboard

The user's home dir is in a different path when Ubuntu is installed from the Microsoft Store

Open 0xjams opened this issue 6 years ago • 2 comments

After a Windows reinstall, Ubuntu was installed differently, and the users' ~ path was in a different Windows location, now it is here:

C:\Users\{name}\AppData\Local\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\

I am not sure if the string right after UbuntuonWindows varies for each installation.

To make it work again, I just changed a line on the function called lxssPath to this:

$lxssPath_ = trim(exec('cmd.exe /c "echo %LOCALAPPDATA%" 2> /dev/null')) . "\\Packages\\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\\LocalState\\rootfs";

I hope this helps.

0xjams avatar May 21 '18 17:05 0xjams

Hmm, yes maybe now that WSL can support multiple Linux images, this trick won't work properly. Thanks anyway for sharing in case it helps somebody.

laurent22 avatar May 21 '18 18:05 laurent22

May be this ~ path could be saved on some config file, If Users path differs then User could change it manually.

Abhinickz avatar Jun 22 '18 18:06 Abhinickz