#211 closed enhancement (fixed)
add a `file-type' procedure to posix unit
Reported by: | felix winkelmann | Owned by: | felix winkelmann |
---|---|---|---|
Priority: | critical | Milestone: | |
Component: | core libraries | Version: | 4.5.x |
Keywords: | posix | Cc: | |
Estimated difficulty: |
Description
`(file-type FILENAME-OR-FD)' -> SYMBOL
Should return one of
regular directory symlink fifo socket char-device block-device
Change History (7)
comment:1 Changed 15 years ago by
Milestone: | 4.5.0 |
---|
comment:2 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 Changed 14 years ago by
Priority: | not urgent at all → critical |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
Unfortunately this change broke the assumption that regular-file?, etc. will return #f if the file does not exist at all. Now, it throws an error. I think quite a bit of code relies on the old behavior--my own does and so does the core itself. For example, posix#create-directory no longer works at all in recursive mode, because it uses directory? to check for directory existence, and non-existent directories will barf.
comment:4 Changed 14 years ago by
Owner: | set to felix winkelmann |
---|---|
Status: | reopened → assigned |
comment:5 Changed 14 years ago by
Milestone: | → 4.6.0 |
---|---|
Version: | → 4.5.x |
The situation is now as follows (master, commit 0cc55fe):
`file-type' takes an optional flag indicating whether a non-existing file should dsignal an error or if the function should return #f (defaults to signalling an error).
All the file-type predicates return #f if given a filename and the file does not exist.
All file-type predicates with the exception of symbolic-link?
follow symlinks.
If this agrees with you, please close the ticket.
comment:6 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Sorry it took me so long to get around to this.
Tests out ok, thanks!
See experimental branch. The file-type predicates (
regular-file?
, etc.) now also accept a file-descriptor.