-
Notifications
You must be signed in to change notification settings - Fork 88
/
AddAutoExp.lua
53 lines (40 loc) · 1.23 KB
/
AddAutoExp.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
require "ex"
function AddAutoExp(autoexpFileName)
local ignore = false
local file = io.open(autoexpFileName .. ".new", "wt")
if os.path.exists(autoexpFileName) then
for line in io.lines(autoexpFileName) do
if line == '; -- LuaPlus and Lua begin --' then
ignore = true
elseif line == '; -- LuaPlus and Lua end --' then
ignore = false
elseif line == '; This section lets you define your own errors for the HRESULT display.' then
for newLine in io.lines('AutoExpAdditions.txt') do
file:write(newLine .. "\n")
end
file:write(line .. "\n")
else
if not ignore then
file:write(line .. "\n")
end
end
end
file:close()
end
os.copyfile(autoexpFileName .. ".new", autoexpFileName)
os.remove(autoexpFileName .. ".new")
end
function AddVSAutoExp(environmentVariable)
local VS = os.getenv(environmentVariable)
if not VS then return end
VS = VS .. '..\\..\\'
AddAutoExp(VS .. "\\Common7\\Packages\\Debugger\\autoexp.dat")
end
AddVSAutoExp("VS80COMNTOOLS")
AddVSAutoExp("VS90COMNTOOLS")
AddVSAutoExp("VS100COMNTOOLS")
AddVSAutoExp("VS110COMNTOOLS")
local XEDK = os.getenv("XEDK")
if XEDK then
AddAutoExp(XEDK .. "\\bin\\win32\\autoexp.dat")
end