[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: os.remove promises more than it can deliver
- From: Reuben Thomas <rrt@...>
- Date: Wed, 8 Jun 2011 13:39:49 +0100
os.remove's documentation says: "Deletes the file or directory with
the given name." But it does not do this. Rather, it calls the
"remove" function, which according to the C standard deletes a file.
On Windows, this is all it can do. On POSIX, remove is equivalent to
unlink for a file or to rmdir for a directory.
Hence, I suggest that the documentation be reworded from:
Deletes the file or directory with the given name. Directories must
be empty to be removed.
to:
Deletes the file with the given name. On some systems [or, "On POSIX
systems"] os.remove can also be used to remove empty directories.
Thanks to Diego Mascarenhas for bringing this to my attention, when I
wondered why LFS still has a rmdir function:
https://github.com/keplerproject/luafilesystem/issues/4
--
http://rrt.sc3d.org