phobo's std.file is completely broke!

Neia Neutuladh neia at ikeran.org
Wed Sep 19 17:49:53 UTC 2018


On Wednesday, 19 September 2018 at 08:54:42 UTC, Vladimir 
Panteleev wrote:
> BTW, something follows from the above:
>
> write(`C:\` ~ (short path) ~  `con`) will fail
>
> but:
>
> write(`C:\` ~ (long path) ~ `con`) will succeed.
>
> This is just one issue I've noticed... there's probably more 
> lurking.

Also, according to the internet:

write(chainPath(shortDirectory, "A "), "Win32 API strips trailing 
space");
readText(chainPath(shortDirectory, "A")); // Win32 API strips 
trailing space

But:
write(chainPath(longDirectory, "A "), "Win32 API strips trailing 
space");
readText(chainPath(longDirectory, "A")); // File not found

write(chainPath(shortDirectory, "A."));  // fails
write(chainPath(longDirectory, "A."));  // succeeds

> This is why I think the whole idea is bankrupt.

This is why we should use the exact same behavior in all cases. 
Always use `\\?\` or never use it.

Since Windows path handling is weird by default, I'd prefer 
always using `\\?\`. It's overhead, but not a huge amount of 
additional overhead compared to filesystem manipulation.


More information about the Digitalmars-d mailing list