From 461d25cb13cb89100c84492e1f80377310827c16 Mon Sep 17 00:00:00 2001 From: Michael Barton Date: Tue, 14 May 2013 13:09:59 +0200 Subject: [PATCH 1/2] Use /cygdrive when rsyncing on windows --- lib/vagrant-rackspace/action/sync_folders.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/vagrant-rackspace/action/sync_folders.rb b/lib/vagrant-rackspace/action/sync_folders.rb index 5caa78b..b121a81 100644 --- a/lib/vagrant-rackspace/action/sync_folders.rb +++ b/lib/vagrant-rackspace/action/sync_folders.rb @@ -1,5 +1,5 @@ require "log4r" - +require 'rbconfig' require "vagrant/util/subprocess" module VagrantPlugins @@ -11,6 +11,7 @@ class SyncFolders def initialize(app, env) @app = app @logger = Log4r::Logger.new("vagrant_rackspace::action::sync_folders") + @host_os = RbConfig::CONFIG['host_os'] end def call(env) @@ -25,6 +26,11 @@ def call(env) # Make sure there is a trailing slash on the host path to # avoid creating an additional directory with rsync hostpath = "#{hostpath}/" if hostpath !~ /\/$/ + + # If on Windows, modify the path to work with cygwin rsync + if @host_os =~ /mswin|mingw|cygwin/ + hostpath = hostpath.sub("C:/", "/cygdrive/c/") + end env[:ui].info(I18n.t("vagrant_rackspace.rsync_folder", :hostpath => hostpath, From 591d0cbaa223fbf0086963d4f85e1a856fa1c84b Mon Sep 17 00:00:00 2001 From: Michael Barton Date: Wed, 21 Aug 2013 21:53:53 +0100 Subject: [PATCH 2/2] All drive letters when using /cygdrive Previously the code rewriting windows drive letters to /cygdrive/ was hard coded to C. Now it supports all letters. --- lib/vagrant-rackspace/action/sync_folders.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vagrant-rackspace/action/sync_folders.rb b/lib/vagrant-rackspace/action/sync_folders.rb index b121a81..41c64b3 100644 --- a/lib/vagrant-rackspace/action/sync_folders.rb +++ b/lib/vagrant-rackspace/action/sync_folders.rb @@ -29,7 +29,7 @@ def call(env) # If on Windows, modify the path to work with cygwin rsync if @host_os =~ /mswin|mingw|cygwin/ - hostpath = hostpath.sub("C:/", "/cygdrive/c/") + hostpath = hostpath.sub(/^([A-Za-z]):\//, "/cygdrive/#{$1.downcase}/") end env[:ui].info(I18n.t("vagrant_rackspace.rsync_folder",