Skip to content
This repository has been archived by the owner on Feb 11, 2022. It is now read-only.

support for folder sync via rsync on windows. #67

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions lib/vagrant-aws/action/sync_folders.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

require "vagrant/util/scoped_hash_override"

require "vagrant/util/which"

module VagrantPlugins
module AWS
module Action
Expand All @@ -28,7 +30,18 @@ def call(env)
# Ignore disabled shared folders
next if data[:disabled]

unless Vagrant::Util::Which.which('rsync')
env[:ui].warn(I18n.t('vagrant_aws.rsync_not_found_warning'))
break
end

hostpath = File.expand_path(data[:hostpath], env[:root_path])

#rsync interprets paths with colons as remote locations.
#We need to pass the "cygdrive" version for the hostpath on windows.
if Vagrant::Util::Platform.windows?
hostpath = Vagrant::Util::Subprocess.execute("cygpath", "-u", "-a", hostpath).stdout.chomp
end
guestpath = data[:guestpath]

# Make sure there is a trailing slash on the host path to
Expand Down
3 changes: 3 additions & 0 deletions locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ en:
Instance is not created. Please run `vagrant up` first.
ready: |-
Machine is booted and ready for use!
rsync_not_found_warning: |-
Warning! Folder sync disabled because the rsync binary is missing.
Make sure rsync is installed and the binary can be found in the PATH.
rsync_folder: |-
Rsyncing folder: %{hostpath} => %{guestpath}
terminating: |-
Expand Down