
Quoting [Ceriel Jacobs] (Aug 17 2009):
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.
Well, directory inherits entry, so you can alw2ays do: saga::url u ("file://localhost/etc/") saga::file::dir d (u); saga::file::entry e = d; // downcast should always work std::cout << u << " is dir: " << e.is_dir () << std::endl; std::cout << u << " is entry: " << e.is_dir () << std::endl; is_dir would return true, is_entry would return false. Sure, sounds strange that is_entry() can return false on an entry, but it is defined as: - the method returns false if the entry is a link or a directory (although an ns_directory IS_A ns_entry, false is returned on a test on an ns_directory) - otherwise true is returned. If the above works, I don't see why saga::file::entry e (u); should not work. Or am I missing something? The same then also holds for the open methods - the origin of Matijs' complain. Best, Andre.
Cheers, Ceriel
-- Nothing is ever easy.