#! /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)