View Single Post
Old 07-14-2014, 08:49 PM   #1303
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,506
Karma: 26047202
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
@Ken Maltby: It doesn't. As I understand it, Kobo has *always* mounted the external SD read-only.

The issue simply lies in the fact that KOReader never tried to write in there before .

We don't bundle luaposix, whose stat wrapper would have been perfect for this (AFAICT), so I had to resort to ugly hacks around io.open to check if we actually did have permission to do what we wanted. Hence the io.open calls, which will return nil if we can't do what we want (and/or if the file doesn't even exists).
So now, if we can't do it, we don't, instead of trying to no matter what, and wonderfully blowing up in subsequent calls because of a non-existant fd.

(I could also argue that, in both cases, dofile & insert are dumb for not handling nil properly themselves, but, hey, it's lua, it's designed to mirror ANSI C, so I can't really complain ;p).

[In case that wasn't obvious, I'm far from lua's biggest fan, so, err, take my comments with a grain of salt ^^]

Last edited by NiLuJe; 07-14-2014 at 08:55 PM.
NiLuJe is offline   Reply With Quote