[Dev-luatex] platform specific functionality

T T t34www at googlemail.com
Mon Mar 15 18:21:48 CET 2010


On 15 March 2010 15:54, Taco Hoekwater <taco at elvenkind.com> wrote:
>
> My man page for realpath(3) says:
>
> BUGS:
>  Avoid using this function. Its is broken by design
>
> But it does not offer an alternate solution.

Bummer.

> Looks like it would need private code, which is not a lot of fun to
> write (unless there is something in kpathsea?).

I agree, if you can't trust the API call, there is no point in hand
coding this in C. It is not trivial and it will be easier to implement
on the Lua side anyway.

On 15 March 2010 16:00, Taco Hoekwater <taco at elvenkind.com> wrote:
>
> What did you need it for anyway? As perhaps the problem it solves
> is win32-only?

The problem was to create a directory path with all intermediate ones
if they don't exist. lfs.mkdir cannot create a hierarchy.

Once I started coding this, I realized it's not so simple in general,
because one needs to resolve the path first, get rid of all the '..'
and '.' etc. GetFullPathName call is very handy for this, so I thought
it would be nice to access it. Too bad that there is no reliable
equivalent on Unix.

For now I ended up with 'cmd.exe /c mkdir
"some\dir\hierarchy\to\create"' :->. I'm not very proud of this
solution but it gets the job done for this particular problem.

Cheers,

Tomek

PS. Perhaps Unix's realpath is not the best match for what
GetFullPathName does. With GetFullPathName the resolved path does not
have to exist.


More information about the dev-luatex mailing list