plumbum
plumbum copied to clipboard
IsExistingFile only works for regular files
I often write scripts that take as arguments sockets, block devices, etc and would like the same thing ExistingFile does for "regular files". I'm wondering if you think ExistingFile
should be modified to also check for is_socket
, is_fifo
, is_char_device
, and is_block_device
as well?
Splitting the predicates into IsRegularFile, IsSocketFile, etc would also seem OK to me, but "is_file" is too broad a name for an API on UNIX IMO.
How does path lib
do it? I'll be able to look at this in a few days, I just got back from a small vacation (and have a conference next week).
I think the following steps would be needed:
- Add
is_symlink()
,.is_fifo()
,.is_block_device()
,.is_char_device()
,.is_reserved()
frompathlib
. - Add several predicates, like
IsSocketFile
- Allow composition,
SocketFile & RegularFile
, etc - ExistingFile would be a shortcut to
SocketFile & ...
Would that work?