Get datadir for machine and project

This commit is contained in:
sophia 2021-08-16 13:54:00 -05:00 committed by Paul Hinze
parent 68aa184bee
commit 10a1f1011b
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
4 changed files with 12 additions and 6 deletions

View File

@ -90,8 +90,7 @@ func (p *Project) Home() (path string, err error) {
// LocalData implements core.Project
func (p *Project) LocalData() (path string, err error) {
// TODO: implement
return "/local/data", nil
return p.dir.DataDir().String(), nil
}
// Tmp implements core.Project

View File

@ -18,7 +18,9 @@ module Vagrant
end
super
@logger = Log4r::Logger.new("vagrant::environment")
@local_data_path = Pathname.new(@client.local_data_path())
if @client != :stub
@local_data_path = Pathname.new(@client.get_local_data_path())
end
end
# Gets a target (machine) by name

View File

@ -71,9 +71,14 @@ module VagrantPlugins
)
end
def get_data_dir
def get_dir
req = Google::Protobuf::Empty.new
Pathname.new(@client.data_dir(req).data_dir)
@client.data_dir(req)
end
def get_data_dir
dir = get_dir
Pathname.new(dir.data_dir)
end
def get_provider

View File

@ -108,7 +108,7 @@ module VagrantPlugins
state = machine_client.get_state()
raw = {
"name" => machine_client.get_name(),
"local_data_path" => machine_client.get_local_data_path(),
"local_data_path" => machine_client.get_data_dir(),
# TODO: get the provider!
"provider" => "virtualbox",
"full_state" => state,