To elaborate:

On Sunday, 16 September 2018 at 22:40:45 UTC, Vladimir Panteleev wrote:
If *YOU* are OK with the consequences of complexity, implement this in YOUR code, but do not enforce it upon others.

This is much better done in user code anyway, because you only need to expand / normalize the path and prepend the prefix only once (root of the directory tree you're operating on), instead of once per directory call.

We could add a `string longPath(string)` function in Phobos (no-op on POSIX, expands and prepends prefix on Windows). I believe I suggested the same in the bug report years ago when we discussed it.

It is absolutely not acceptable behavior. Complain to Microsoft. The OS should not allow users to create or select paths that programs cannot operate on without jumping through crazy hoops.

Microsoft could have solved this easily enough:

extern(System) void AllowLongPaths();

Programs (or programming language runtimes) which can handle paths longer than MAX_PATH could call that function. It can also be used as a hint to the OS that file/directory selection dialogs, as you mentioned, are allowed to select paths longer than MAX_PATH.

Reply via email to