aik099/PhpStormProtocol

wsl + docker + win10 problem

Closed this issue · 9 comments

I use sail - docker + win10(wsl) in my laravel project. My projects dir is "\wsl$\Ubuntu\home\vladimirb\projects"
base exception link:

phpstorm://open?file=%2Fhome%2Fvladimirb%2Fprojects%2Flearn%2Fe-com-laravel%2Fresources%2Fviews%2Fwelcome.blade.php&line=20

and it opens well when i manually type in browsers url line:

phpstorm://open?file=\\wsl$\Ubuntu\%2Fhome%2Fvladimirb%2Fprojects%2Flearn%2Fe-com-laravel%2Fresources%2Fviews%2Fwelcome.blade.php&line=20

My question is: what should i use here in cfg file:

 // In case your file is mapped via a network share and paths do not match.
 // eg. /var/www will can replaced with Y:/
    projects_basepath: '',
    projects_path_alias: '',

?

@vladimirbalin , I can't give you an exact answer, because I don't know the path to files inside a Docker, but here is an example, that might help:

  1. GuestOS (where a Web Server runs) has a PHP file at "/home/dev/sites/index.php"
  2. HostOS (where Virtual Machine with GuestOS runs on) accesses that file via "C:\Users\your_username\Documents\sites\index.php"
  3. You'll need this config:
projects_basepath: '/home/dev/',
projects_path_alias: 'C:/Users/your_username/Documents/',

Hope that helps.

Guest OS Docker path:

/var/www/html/public/index.php

HostOS path of the same file:

\\wsl.localhost\Ubuntu\home\vladimirb\projects\learn\e-com-laravel\public\index.php

Tried some combination of these pathes, but still dont get it.

But most often, when executing this script, a file was created and opened in the directory "C:\home\vladimirb\projects\learn\e-com-laravel...".
So its just takes file from

phpstorm://open?file=/home/vladimirb/projects/learn/e-com-larave/resources/views/welcome.blade.php&line=20

and appends to C:/ by some reason

e-com-laravel is the name of the project folder where .idea exists

Do you have only 1 project on the Docker VM?

If that is so, then the following configuration would do the trick:

projects_basepath: '/var/www/html/public/',
projects_path_alias: '\\wsl.localhost\Ubuntu\home\vladimirb\projects\learn\e-com-laravel\public\',

Is the \\wsl.localhost\Ubuntu\ a network mount on MS Windows?

Do you have only 1 project on the Docker VM?

Is the \\wsl.localhost\Ubuntu\ a network mount on MS Windows?

  1. Yes, at once it only runs 1 project, but still doesnt work. It creates all directories and opens well but in C:\home\vladimirb...*file with exception*&line=132
  2. Yes, bassically its kind of a network mount on Win 10

You need to debug it somehow (maybe using MsgBox or real-time debugging if such exists):

  • what URL comes in
  • what URL comes out
  • what gets replaced to what

Probably it has something to do with $ in URL.

I think problem that it doesnt replace anything in file variable

Screenshots

Screenshot_2
Screenshot_1

Ok, hardcoded like this, it finally works. Pretty dirty solution, gonna check little later and will comment here.

Screenshot

Screenshot_3

We were need to replace(actually just add to start of the line) first '/' with the '//wsl$/Ubuntu', so we need to do like this:

projects_basepath: '/',
projects_path_alias: '//wsl$/Ubuntu/',

Glad you're able to figure that out.