local vsvar = {}

local function exists(mpath)
	local file = io.open(mpath, "r")
	if file then
		io.close(file)
		return true
	else
		return false
	end
end

function vsvar.get(config)
	local vs2015_x64 = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/vcvars64.bat"
	if exists(vs2015_x64) then
		table.insert(config, {
			label = "vs2015_x64",
			args = {
				"cmd.exe",
				"/k",
				vs2015_x64,
			},
		})
	end

	local vs2022_x64 = "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvars64.bat"
	if exists(vs2022_x64) then
		table.insert(config, {
			label = "vs2022_x64",
			args = {
				"cmd.exe",
				"/k",
				vs2022_x64,
			},
		})
	end
end

return vsvar