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
|
#! /usr/bin/env texlua
function fixwin(args_unix)
if os.type == 'windows' then
local args_win={} -- new table
args_win[0]=args_unix[1]
for i=1, #args_unix do
args_win[i]='"'..args_unix[i]..'"'
end
return args_win
else
return args_unix
end
end
if string.find(arg[0], '/') then -- UNIX path
basename = select(1, string.gsub(arg[1], '.*/', ''))
elseif string.find(arg[0], '\\') then -- Windows path
basename = select(1, string.gsub(arg[1], '.*\\', ''))
-- we might have \ and / mixed together ...
basename = select(1, string.gsub(basename, '.*/', ''))
else -- no path
basename = arg[1]
end
kpse.set_program_name(basename..".bat", basename)
TLROOT=kpse.var_value('SELFAUTOPARENT')
BINDIR=kpse.var_value('SELFAUTOLOC')
os.setenv('PATH', TLROOT..'/tlpkg/tlgs/bin;'..os.getenv('PATH'))
os.setenv('GS_LIB', TLROOT..'/tlpkg/tlgs/lib;'..TLROOT..'/tlpkg/tlgs/fonts')
os.setenv('TLROOT', TLROOT)
script=kpse.find_file(basename..'.rb', 'texmfscripts')
command={'ruby.exe', script}
for i=2, #arg do
command[#command+1]=arg[i]
end
command=fixwin(command)
--[[ Prepend an additional hyphen to activate this code.
for i=0, #command do
print (command[i])
end
os.exit(ret)
--]]
ret=os.spawn(command)
os.exit(ret)
|