phobo's std.file is completely broke!

Ecstatic Coder ecstatic.coder at gmail.com
Thu Sep 20 05:53:51 UTC 2018


On Thursday, 20 September 2018 at 03:15:20 UTC, Vladimir 
Panteleev wrote:
> 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.

*Windows Explorer* prevents you from creating a folder or file 
whose name STARTS with spaces. It trims them automatically, 
whether you want it or not.

So it's NOT a surprise that *Windows Explorer* (!) has problems 
if you use it on such files which were created manually.

But obviously, *Windows* OS doesn't prevent you to create them 
through scripts and applications...






More information about the Digitalmars-d mailing list