Vagrant: Allow traditional Windows backslash "\" in synced_folder definition

Created on 13 Jun 2013  路  1Comment  路  Source: hashicorp/vagrant

Vagrantfile does not seem to understand traditional Windows' paths with backslashes. Instead it (seems) to just strip them and then complain of the invalid path.

The following

config.vm.synced_folder "C:\Users\Giraffeslacks\Documents\Vagrant Shares", "/vagrant"

results in

There are errors in the configuration of this machine. Please fix
the following errors and try again:

vm:
* The host path of the shared folder is missing: C:UsersGiraffeslacksDocumentsVagrant Shares

With forward slashes the result is as expected: success.

As an alternative to making backslashes compatible I would suggest that Vagrant detect the problem and complain appropriately. Something like: Please use a forward slash "/" in all paths.

Most helpful comment

This actually works fine. The issue was that you weren't escaping your slashes. You should do C:\\Users\\Blah\\Blah because in Ruby strings the \ character signals an escape character.

>All comments

This actually works fine. The issue was that you weren't escaping your slashes. You should do C:\\Users\\Blah\\Blah because in Ruby strings the \ character signals an escape character.

Was this page helpful?
0 / 5 - 0 ratings