Description
A lot of the filesystem API is not explicit about its behaviour. This includes:
- Will operations silently overwrite files/directories, or fail instead?
- Platform-specific semantics
- Which underlying OS APIs are used
- What the result of a failed operation might be (for example, deleting a directory might fail with some files being deleted and others not)
Without this documentation it makes it very difficult to write robust tools which access the filesystem, especially if they have to be cross-platform. There also seem to be several places where the library could attempt to be more consistent across platforms.
A simple example is what happens in the case of symlinks. On linux, you delete a directory symlink the same way you delete a file, whereas on windows you should delete it the same way you'd delete a directory. It would be useful if there was a safe way to delete a directory symlink that is both cross-platform, and is guaranteed not to delete the contents of the directory.
Another example is renaming: can you rename a directory onto another? It doesn't seem so, but you can't just delete the destination first, in case the source == the destination, in which case you'll delete the wrong files! But at the same time, there's no way to test paths for equality reliably.
edit:
Another example: how relative paths are treated when creating a symlink. Is a relative path resolved before creating the symlink, or afterwards? Is that true on all platforms?