
Hi, As a side comment, my use case was "test whether an arbitrary URL points to a file or a directory". My first idea was (in pseudo code): url u = new url(<string to test>); ns_entry e = new ns_entry(u); print e.is_dir() This does not work in general, since the constructor of ns_entry throws a BadParameter exception when the URL denotes a directory. But since that exception may also be thrown in other error conditions, it cannot be used to recognize a directory. Similarly, creating a ns_directory instead of an ns_entry doesn't work either. The only generic way seems to manually split the URL in a parent directory and a suffix, create an ns_directory object for the parent and use ns_directory.is_dir(suffix). Not really Simple... best, -Mathijs On Mon, 2009-08-17 at 07:48 +0200, Ceriel Jacobs wrote:
Andre Merzky wrote:
You are right: open should be able to open entries and directories (which *are* entries). open_dir should work only for directories. Same holds then indeed for the entry and dir constructors.
Are you sure? I have an issue with what you are saying about the entry constructor. I think that if a ns_entry object represents a directory, it should in fact be a ns_directory object.
Cheers, Ceriel