RE: [boost] [filesystem] size() on directory?

Beman wrote: How should size( "foo" ) behave if "foo" is a directory? 1) Throw. The function should be renamed file_size(). 2) Return 0. Directories don't strictly speaking have a size. 3) Return the number of entries in the directory. Directories are really just containers; so of course they have a size. ------------------------------------------------- Gary Replies: #1, while an OS can implement directories as a file of information, I think its conceptually wrong for this function to ask for its "size". When iterating through a file system you should first guarantee that the file name is a file and not that of a sub directory. The 4th answer would be to return the total size of all the files within the directory. But I think that's also conceptually confusing as well. Yours, -Gary-
participants (1)
-
Powell, Gary