phobo's std.file is completely broke!
Ecstatic Coder
ecstatic.coder at gmail.com
Fri Sep 21 07:11:53 UTC 2018
On Thursday, 20 September 2018 at 19:49:01 UTC, Nick Sabalausky
(Abscissa) wrote:
> On 09/19/2018 11:45 PM, Vladimir Panteleev wrote:
>> On Thursday, 20 September 2018 at 03:23:36 UTC, Nick
>> Sabalausky (Abscissa) wrote:
>>> (Not on a Win box at the moment.)
>>
>> I added the output of my test program to the gist:
>> https://gist.github.com/CyberShadow/049cf06f4ec31b205dde4b0e3c12a986#file-output-txt
>>
>>
>>> assert( dir.toAbsolutePath.length > MAX_LENGTH-12 );
>>
>> Actually it's crazier than that. The concatenation of the
>> current directory plus the relative path must be < MAX_PATH
>> (approx.). Meaning, if you are 50 directories deep, a relative
>> path starting with 50 `..\` still won't allow you to access
>> C:\file.txt.
>>
>
> Ouch. Ok, yea, this is pretty solid evidence that ALL usage of
> non-`\\?\` paths on Windows needs to be killed dead, dead, dead.
>
> If it were decided (not that I'm in favor of it) that we should
> be protecting developers from files named " a ", "a." and
> "COM1", then that really needs to be done on our end on top of
> mandatory `\\?\`-based access. Anyone masochistic enough to
> really WANT to deal with MAX_PATH and such is free to access
> the Win32 APIs directly.
+1
On Windows, every logical path provided to the std file functions
should be properly converted to a physical path starting with
that prefix.
Obviously this won't solve ALL Windows-specific problems, but
that will AT LEAST remove a whole class of them.
More information about the Digitalmars-d
mailing list