[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-hackers] [PATCH] Make `glob' skip nonexistent/unreadable direct
[Chicken-hackers] [PATCH] Make `glob' skip nonexistent/unreadable directories
Mon, 8 Jan 2018 22:02:39 +1300
Here's a small patch that changes the behaviour of `glob' slightly, so
that it can be used without error when a pathname part doesn't exist. My
thinking here is that, since globs are fundamentally about convenience,
it's best to make the behaviour of `glob` easier to use, and leave the
lower-level file handling to `directory', `find-files', etc.
For example, (glob "/nonexistent/*") will currently raise an error,
which is counter to how file globbing works in most other languages, and
not generally how globbing is expected to work either, I think. So,
let's instead make this return '(), so that (glob <present> <absent>) =>
(<present>). The same goes for unreadable files.
Note that this will change the behaviour of some of the egg tools
slightly in their treatment of missing directories in
CHICKEN_REPOSITORY_PATH and CHICKEN_INSTALL_REPOSITORY, since they use
globs to collect files. This is intentional. For example,
`CHICKEN_REPOSITORY_PATH=/nonexistent chicken-status` currently raises a
"directory not found" error, but that's not typically how PATH-style
variables are treated and I think it's better to skip nonexistent
entries. So, this patch will have that effect, too.
Let me know your thoughts on this.
Description: Text Data
- [Chicken-hackers] [PATCH] Make `glob' skip nonexistent/unreadable directories,
Evan Hanson <=