[dev-context] context program, mtxrun question?

Taco Hoekwater taco at elvenkind.com
Sat May 24 19:11:28 CEST 2008

Hans Hagen wrote:
> Oliver Buerschaper wrote:
>> Obviously, the problem is the symbolic link because LuaTeX tries and  
>> finds argv[0] in $PATH but doesn't resolve /usr/texbin to its actual  
>> location on disk. It's clear that in this situation there can't be 
>> any  difference between the distribution-independent syntax of 
>> calling  luatex and the direct invocation.
>> Do you think LuaTeX's path discovery mechanism could be adapted to  
>> handle symbolic links?
> there is lfs.symlinkattributes but i'm somewhat reluctant to usinmg 
> platform specific things; if i have time i'll see if this function 
> returns something useful

No need, here is function that works and is portable to all platforms:

function input.getownpath()
    local olddir = lfs.currentdir()
     if not input.ownpath then
        for p in 
string.gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do
             p = lfs.currentdir()
             local b = file.join(p,input.ownbin)
             if lfs.isfile(b..".exe") or lfs.isfile(b) then
                 input.ownpath = p
         if not input.ownpath then input.ownpath = '.' end
     return input.ownpath

Oliver, I have emailed you a patched version of luatools.lua. Can
you try to make sure that it works for you as well? (It should, but ...)

Best wishes,

More information about the dev-context mailing list