[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How do I test for the existens of a file
- From: David Given <dg@...>
- Date: Fri, 24 Oct 2008 23:42:36 +0100
Jeff Pohlmeyer wrote:
[...]
> On Linux the io.open(name, "r") will fail even on an existing
> file if you don't have read permissions, and will succeed if
> you do, even when the "name" is actually a directory. (Which
> might not be what you expect.)
Don't forget that on Windows it might also fail if the file is in use by
another application; a lot of Windows apps appear to default to
exclusive file access, and the Windows kernel enforces it.
(e.g. if I open a ZIP file in 7-Zip and then forget to close the window
before running the script to regenerate the file, it fails horribly. Grr.)
--
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│
│ ⍎'⎕',∊N⍴⊂S←'←⎕←(3=T)⋎M⋏2=T←⊃+/(V⌽"⊂M),(V⊝"M),(V,⌽V)⌽"(V,V←1⎺1)⊝"⊂M)'
│ --- Conway's Game Of Life, in one line of APL
Attachment:
signature.asc
Description: OpenPGP digital signature