如何使用相对路径在Homestead.yaml中映射项目目录 [英] How to map project directory in Homestead.yaml using relative path
问题描述
使用我希望Homestead.yaml文件将项目目录映射为Vagrant VM中可访问的文件夹.
I want the Homestead.yaml file to map the project directory as a folder accessible in the Vagrant VM.
我想要这样做,以便Homestead.yaml文件可以在开发机器之间共享而无需更改.
I want to do this such that the Homestead.yaml file can be shared between development machines without alteration.
Homestead.yaml文件和Vagrantfile文件位于项目目录中.
The Homestead.yaml file is in the project directory as is the Vagrantfile file.
因此,我想相对地而不是通过其完整路径来标识项目目录.
Therefore I want to identify the project directory relatively, rather than by its full path.
类似的东西:
folders:
-
map: %CurrentDir%
to: /home/vagrant/Code/project
(为了这个示例,我发明了%CurrentDir%.)
(I invented %CurrentDir% for the sake of this example.)
甚至在不对项目目录的名称进行硬编码的情况下甚至更好.
Or even better without hardcoding the name of the project directory.
我在Windows上,并且希望使用与平台无关的解决方案.
I'm on Windows and would prefer a platform-agnostic solution.
我该怎么做?
推荐答案
此方法适用于带流浪者2.0.1/homestead 6.5的macOSX:
This works on macOSX w/ vagrant 2.0.1 / homestead 6.5:
folders:
-
map: ./
to: /home/vagrant/code/project
这篇关于如何使用相对路径在Homestead.yaml中映射项目目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!