How to work with long paths on Windows?

Preetpal preetpal.sohal at gmail.com
Mon Nov 14 14:43:50 UTC 2022


On Monday, 14 November 2022 at 10:44:11 UTC, Imperatorn wrote:
> On Tuesday, 13 September 2022 at 19:54:15 UTC, Preetpal wrote:
>> In Windows 10, Version 1607 (and later), you can [enable long 
>> paths](https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry) which bypasses the MAX_PATH limitation for local paths (e.g., C:\Users\you\log.txt). Currently if you iterate over a directory with a file exceeding the MAX_PATH limitation for local paths, an exception is thrown. There is no limitation on Linux (tested using GDC on the Windows Subsystem for Linux) and this issue occurs when using either the LDC2 or DMD compilers on Windows. It's very common to have these sorts of paths if you use [npm](https://www.npmjs.com/).
>>
>> [...]
>
> Have you set longPathAware in the applications manifest?

Yeah that's how I dealt with the issue. I just replied to my own 
question with a working example that people who might find this 
post can refer to: 
[gist](https://gist.github.com/preetpalS/2fd6c6bf05a94734f89b70b679716bf3) (see my comment in the gist for how to make it work).


More information about the Digitalmars-d-learn mailing list