On Wednesday, 19 September 2018 at 06:11:22 UTC, Vladimir
Panteleev wrote:
One point of view is that the expected behavior is that the
functions succeed. Another point of view is that Phobos should
not allow programs to create files and directories with invalid
paths. Consider, e.g. that a user writes a program that creates
a large tree of deeply nested filesystem objects. When they are
done and wish to delete them, their file manager fails and
displays an error. The user's conclusion? D sucks because it
corrupts the filesystem and creates objects they can't operate
with.
You don't even need to use crazy third-party software.
Try this program:
mkdir(`\\?\C:\ a \`);
write(`\\?\C:\ a \a.txt`, "Hello");
Then, try doing the following:
- Double-click the created text file.
- Try deleting the directory from Explorer (by sending it to the
recycle bin).
- Try permanently deleting it (Shift+Delete).
- Try renaming it.
All of these fail for me. Deleting the directory doesn't even
show an error - nothing at all happens.
When the OS itself fails to properly deal with such files, I
don't think D has any business in *facilitating* their creation
by default.