diff --git a/plugins/pushes/ftp/adapter.rb b/plugins/pushes/ftp/adapter.rb index 8a9414376..b4c4f48f2 100644 --- a/plugins/pushes/ftp/adapter.rb +++ b/plugins/pushes/ftp/adapter.rb @@ -74,7 +74,7 @@ module VagrantPlugins # Create the parent directories if they does not exist (naive mkdir -p) fullpath.descend do |path| - if @server.list(path.to_s).empty? + unless check_dir_exists? path.to_s @server.mkdir(path.to_s) end end @@ -83,6 +83,15 @@ module VagrantPlugins @server.putbinaryfile(local, remote) end + def check_dir_exists?(path) + begin + @server.chdir(path) + return true + rescue Net::FTPPermError + return false + end + end + private def pwd