phobo's std.file is completely broke!

Nick Sabalausky (Abscissa) SeeWebsiteToContactMe at semitwist.com
Thu Sep 20 07:59:55 UTC 2018


On 09/19/2018 11:15 PM, 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.
> 

I used to be a pure Windows user for a long, long time. Trust me, if 
you're using Windows, you run into PLENTY of ways to generate files that 
explorer can't handle. Even the system's own commandline makes their 
creation trivial (it also makes it trivial remove/rename such files, 
too). Very little else on Windows has the same bizarre, 
inconsistent-with-the-OS-itself limitations that explorer has. It's a 
jungle. Welcome to Windows. *shrug*


More information about the Digitalmars-d mailing list