Implement sorting of synced_folders
It's useful if you want to mount something inside /vagrant or if you have some another mount in some synced folder. This piece of code is extracted from virtualbox driver.
This commit is contained in:
parent
47cf361b98
commit
9f9cb1c791
1 changed files with 9 additions and 0 deletions
|
@ -8,6 +8,15 @@ module Vagrant
|
||||||
|
|
||||||
def prepare(machine, folders, _opts)
|
def prepare(machine, folders, _opts)
|
||||||
machine.ui.output(I18n.t("vagrant.actions.lxc.share_folders.preparing"))
|
machine.ui.output(I18n.t("vagrant.actions.lxc.share_folders.preparing"))
|
||||||
|
# short guestpaths first, so we don't step on ourselves
|
||||||
|
folders = folders.sort_by do |id, data|
|
||||||
|
if data[:guestpath]
|
||||||
|
data[:guestpath].length
|
||||||
|
else
|
||||||
|
# A long enough path to just do this at the end.
|
||||||
|
10000
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
folders.each do |id, data|
|
folders.each do |id, data|
|
||||||
host_path = Pathname.new(File.expand_path(data[:hostpath], machine.env.root_path))
|
host_path = Pathname.new(File.expand_path(data[:hostpath], machine.env.root_path))
|
||||||
|
|
Loading…
Reference in a new issue