[GH-6] Move provider specific cache dir to the right path if a single cache dir exists
This commit is contained in:
parent
f8d8b2f9cf
commit
9f90f43a21
1 changed files with 5 additions and 2 deletions
|
@ -36,13 +36,16 @@ module VagrantPlugins
|
|||
dirs: cache_dirs.join("\n")
|
||||
else
|
||||
current_path = provider_specific_cache_dirs.first.to_s.gsub(/^#{@env[:root_path]}\//, '')
|
||||
new_path = @env[:machine].data_dir.parent.join('cache').to_s.gsub(/^#{@env[:root_path]}\//, '')
|
||||
new_path = @env[:machine].data_dir.parent.join('cache')
|
||||
FileUtils.rm_rf new_path.to_s if new_path.directory?
|
||||
|
||||
new_path = new_path.to_s.gsub(/^#{@env[:root_path]}\//, '')
|
||||
# If we got here there is a single provider specific cacher dir, so
|
||||
# let's be nice with users and just fix it ;)
|
||||
@env[:ui].warn I18n.t('vagrant_cachier.will_fix_machine_cache_dir',
|
||||
current_path: current_path,
|
||||
new_path: new_path)
|
||||
raise 'Move cache dir around'
|
||||
FileUtils.mv current_path, new_path
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue