Skip to content

Add limited support for long pathnames on the command line (#15828)#17440

Open
mgroeber9110 wants to merge 1 commit intonotepad-plus-plus:masterfrom
mgroeber9110:15828-long-pathnames
Open

Add limited support for long pathnames on the command line (#15828)#17440
mgroeber9110 wants to merge 1 commit intonotepad-plus-plus:masterfrom
mgroeber9110:15828-long-pathnames

Conversation

@mgroeber9110
Copy link
Copy Markdown

This is my first attempt at implementing the idea I mentioned in #15828 for a "cheap" way of adding initial support for long (>260) pathnames to the code. I have been using a similar workaround in an external batch file for some time now, and it has turned out to be useful enough for my case.

This change does two things:

  • Use a variable-sized buffer for making pathnames absolute (by querying the required size beforehand), instead of a fixed-size one, to avoid failing for long paths.
  • If the resulting name is too long, use the GetShortPathName function to retrieve a path using 8+3 names instead of the written-out forms. Because Notepad++ is not marked as long-path-aware in the manifest, this requires prefixing paths temporarily with either \\?\ (for local drives) or \\?\UNC\ (for UNC paths) to request long path support.

This still does not cover all possible cases, as paths may still be too long even after the shortening (or some file systems might not have short names at all), but it has the advantage of requiring minimal code changes, and fitting entirely into relativeFilePathToFullFilePath.

A future change could make the entire code long path proof, as @softmgr describes, and apply the shortening only to legacy plugins that may not be compatible with long paths.

@donho donho self-assigned this Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants