Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#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 12 years ago by felix winkelmann

Milestone: 4.5.0

comment:2 Changed 11 years ago by felix winkelmann

Resolution: fixed
Status: newclosed

See experimental branch. The file-type predicates (regular-file?, etc.) now also accept a file-descriptor.

comment:3 Changed 11 years ago by Jim Ursetto

Priority: not urgent at allcritical
Resolution: fixed
Status: closedreopened

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 11 years ago by felix winkelmann

Owner: set to felix winkelmann
Status: reopenedassigned

comment:5 Changed 11 years ago by felix winkelmann

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 11 years ago by Jim Ursetto

Resolution: fixed
Status: assignedclosed

Sorry it took me so long to get around to this.
Tests out ok, thanks!

comment:7 Changed 11 years ago by felix winkelmann

Milestone: 4.6.0

Milestone 4.6.0 deleted

Note: See TracTickets for help on using tickets.