[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: My program doesn't speak Portugese!
- From: David Given <dg@...>
- Date: Tue, 23 Feb 2016 22:11:52 +0100
I've just had a report that WordGrinder is failing on a system with a
Portugese locale. This turns out to be because it's got localised errno
strings. So, my code, which does this:
local fp, e = io.open("somefile")
if e and not e:find("No such file or directory") then
dosomething()
end
...gets confused, because the actual string in e is "Arquivo ou
diretório não encontrado".
I *could* do something really evil:
local _, filenotfound = io.open("/this/file/is/guaranteed/missing")
if e != filenotfound then
dosomething()
end
...but I can't really guarantee that the path doesn't exist.
What I'd really prefer is an errno (and a set of errno constants). But
Lua doesn't expose those. Any suggestions?
--
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│ "There is nothing in the world so dangerous --- and I mean *nothing*
│ --- as a children's story that happens to be true." --- Master Li Kao,
│ _The Bridge of Birds_
Attachment:
signature.asc
Description: OpenPGP digital signature