Re:C++ Filesystem Technical Specification approved by ISO
by roel_v on Saturday January 03, 2015 @08:33AM
(#8830699)
The scope is just to provide a way to write cross-platform path manipulation code. C++ is a much more stable (for better or for worse) language than Java is. Filesystem has been developed for 10+ years, and now that the current version works well, it's promoted to the standard. Whoever will want to write virtual file systems isn't going to bother with std::filesystem anyway.
Re:C++ Filesystem Technical Specification approved by ISO
by sedeki on Saturday January 03, 2015 @10:43AM
(#8830969)
Newbie here. Just curious, why wouldn't someone use std::filesystem to write virtual file systems?
Re:C++ Filesystem Technical Specification approved by ISO
by roel_v on Saturday January 03, 2015 @12:03PM
(#8831212)
Not sure I understand the question - std::filesystem is 'just' a (mostly) cross-platform abstraction of files and directories, it doesn't know or deal with the concept of 'filesystem'. (maybe the problem is in terminology - 'filesystem' in std::filesystem doesn't have anything to do with 'filesystem' as in ext4, zfs etc.)
Re:C++ Filesystem Technical Specification approved by ISO
by tedunangst on Saturday January 03, 2015 @07:47AM
(#8830635)
Looks like they're just including posix semantics. But it is weird and I don't see the point. The only platforms likely to offer this interface already offer the posix interface. If I'm on a posix system, I can just call stat(). Calling filesystem::is_socket() would only make my code less portable by restricting it to the latest c++ runtimes.
Re:C++ Filesystem Technical Specification approved by ISO
by roel_v on Saturday January 03, 2015 @08:35AM
(#8830702)
"Looks like they're just including posix semantics."
No they're not. Filesystem is an abstraction of paths, directories, file status and the like. For example, posix doesn't have a notion of 'platform native display format' (i.e. slash as directory separator on Windows), so without a library like filesystem you have to write your own abstraction layer for that sort of stuff.
Re:C++ Filesystem Technical Specification approved by ISO
by tedunangst on Saturday January 03, 2015 @08:53AM
(#8830724)
The particular set of file types recognized (character device? block device?) are clearly ripped straight from posix. It even says implementations should try to match posix. But ok, yes, this is more than just posix. This is posix plus directory separator character.
FWIW, I've found automagic backslash handling more trouble than its worth. Everything seems to just work until it doesn't. A pathname is inevitably "pretty printed" on Windows which then makes its way as input to a unix system where it's interpreted incorrectly. Of course, back then we called this boost.
In effect this looks a lot like Java's java.io.File (modulo some of the design warts in that), which in Java land people are trying to replace with FileSystem and Path (http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileS...). Java's Path is specific to a file system, so that users can implement their own FileSystemProvider (http://docs.oracle.com/javase/7/docs/api/java/nio/file/spi/F...).
I wonder why they went that way? Or am I missing something?