summaryrefslogtreecommitdiff
path: root/Master/bin/win32/updmap.texlua
blob: f70f805dfd415146a2d10e2791a2e1cde65d12ed (plain)
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
54
55
56
57
58
59
60
#!/xusr/bin/env texlua
--*-Lua-*-
-- $Id$

-- Copyright (C) 2007 Reinhard Kotucha.
-- You may freely use, modify and/or distribute this file.

-- Wrapper for Perl scripts.

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
   filename=select(1, string.gsub(arg[0], ".*/", ""))
elseif string.find(arg[0], "\\") then -- Windows path
   filename=select(1, string.gsub(arg[0], ".*\\", ""))
else -- no path
   filename=arg[0]
end

basename=select(1, string.gsub(filename, "\.texlua$", ""))

kpse.set_program_name(filename)

if string.find(basename, "-sys$") then
   basename=select(1, string.gsub(basename, "-sys$", ""))
   os.setenv("TEXMFVAR", kpse.var_value("TEXMFSYSVAR"))
   os.setenv("TEXMFCONFIG", kpse.var_value("TEXMFSYSCONFIG"))
end


TEXDIR=kpse.var_value("SELFAUTOPARENT")

os.setenv("PERL5LIB", TEXDIR.."/tlpkg/tlperl/lib")
os.setenv("GS_LIB", TEXDIR.."/tlpkg/tlgs/lib")
os.setenv("PATH", TEXDIR.."/tlpkg/tlgs/bin;"..os.getenv("PATH"))

perlbin=TEXDIR.."/tlpkg/tlperl/bin/perl.exe"
script=kpse.find_file(basename..".pl", "texmfscripts")

command={perlbin, script}

for i=1, #arg do
    command[#command+1]=arg[i]
end

command=fixwin(command)

ret=os.spawn(command)
os.exit(ret)