def conf_file
vmx_path = File.join path, "*.vmx"
conf_files = Dir.glob vmx_path
response = Response.new
case conf_files.count
when 0
response.code = 1
response.message = "Unable to find a config file for VM '#{@name}' (in '#{vmx_path}')"
when 1
response.code = 0
response.data = conf_files.first
else
if conf_files.include?(File.join(File.dirname(vmx_path), "#{@name}.vmx"))
response.code = 0
response.data = File.join(File.dirname(vmx_path), "#{@name}.vmx")
else
response.code = 1
output = "Multiple config files found for VM '#{@name}' ("
output << conf_files.sort.map { |f| "'#{File.basename(f)}'" }.join(', ')
output << " in '#{File.dirname(vmx_path)}')"
response.message = output
end
end
response
end