Can’t open files with 103 char filenames, 259 char paths



  • @M-Andre-Z-Eckenrode said in Can’t open files with 103 char filenames, 259 char paths:

    asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnmq.txt

    On windows7 x64 I can confirm the problem with the 259 long path. Another editor can open it. But I am not able to create longer filenames, windows7 refuses to let me do that.



  • So just what are the filename and pathname length limits these days (Win10, and to a lesser interest, Win7)? One would argue “Why should there be a maximum?”

    Do these correspond with what Notepad++ can handle?

    Maybe I’m just posing questions, not actively seeking answers… :-)





  • @Ekopalypse

    Well, that’s the standard answer – the company line, so to speak.
    Does it conform to reality?
    I mean, if the OP is to be believed (no reason to doubt him), he was able to open longer paths than the one “right on the border” that was giving him trouble.
    Of course, I tried his longer paths and couldn’t open those (Win10).

    Also curious about “really lengthening the limit” as described in your link.
    I wonder if it fully works for Notepad++.
    Meaning that the link lists API function names, does Notepad++ only use those? Likely not.
    Of course I’m sure that N++ source code is full of usage of MAX_PATH in declaring buffer sizes for paths, anyway…



  • @Alan-Kilborn said in Can’t open files with 103 char filenames, 259 char paths:

    Does it conform to reality?

    Maybe, maybe not. Who controls the matrix?? Neo?? Me :-D

    I mean, if the OP is to be believed (no reason to doubt him), he was able to open longer paths than the one “right on the border” that was giving him trouble.
    Of course, I tried his longer paths and couldn’t open those (Win10).

    Also curious about “really lengthening the limit” as described in your link.
    I wonder if it fully works for Notepad++.
    Meaning that the link lists API function names, does Notepad++ only use those? Likely not.

    Not sure one has already bothered to test this…

    Of course I’m sure that N++ source code is full of usage of MAX_PATH in declaring buffer sizes for paths, anyway…

    Yeah, currently, 278 matches found.



  • @mere-human said in Can’t open files with 103 char filenames, 259 char paths:

    Ok I see. Can somebody create an issue on GitHub? Or maybe, there is one already.

    I thought that someone had during the old discussion I linked to, but I couldn’t find one. I searched for “long path” in the issues, and found https://github.com/notepad-plus-plus/notepad-plus-plus/issues/9181 , which appears to be related. I added links to this topic and the other one I mentioned in the issue.



  • @Ekopalypse said in Can’t open files with 103 char filenames, 259 char paths:

    I am not able to create longer filenames, windows7 refuses to let me do that.

    Confirmed here, when using Windows Explorer I am neither able to copy files with names longer than 103 characters to my long T:\ path, nor rename them to longer names in place. For the record, the file manager I normally use is Directory Opus, which is evidently able to do both.

    Note that once these files have been created/copied-to/renamed in DOpus, I can open an Explorer window, navigate to their location, and they are all correctly displayed there. Noteably, I can drag-and-drop all but the 103-char-name file onto my NPP window, and they open.

    Also, noteably, in the current phase of this test, NPP will NOT open the 103- or 104-char-name files when drag-and-droppped from DOpus, but it DOES open the 104-char-name file via Ctrl+O. All longer filenames I’ve tried open by either method so far.

    I should also mention that every long filename+path I’ve tried so far has successfully been opened in regular Windows Notepad.

    Would it be useful for me to 7-zip my batch of test files (103–110 character names) in their long path and upload it somewhere?

    @Alan-Kilborn said in Can’t open files with 103 char filenames, 259 char paths:

    I tried his longer paths and couldn’t open those (Win10).

    Just clarifying: You were able to create/copy/rename to longer filenames, but not open in NPP? Did you try both drag-and-drop and Ctrl+O?



  • @M-Andre-Z-Eckenrode

    Uploading, not sure if that help here but might be helpful for the git issue.
    Curious, can you check your LongPathsEnabled registry key from
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem ?



  • @M-Andre-Z-Eckenrode said in Can’t open files with 103 char filenames, 259 char paths:

    Would it be useful for me to 7-zip my batch of test files (103–110 character names) in their long path and upload it somewhere?

    Probably. How about the most-appropriate issue that @PeterJones cited.

    You were able to create/copy/rename to longer filenames, but not open in NPP? Did you try both drag-and-drop and Ctrl+O?

    I did try both drag-and-drop and File > Open (dialog) approaches, but probably not on rigorously on each and every file. Just did some spot-checking.

    My directory manager program (XYPlorer) colors in red paths that are “too long”. Interestingly, your original complaint file it leaves non-red but one character longer and it colors it red.

    I suppose Notepad++ could have trouble with your original file because…and this is a big MAYBE…it might declare buffer[MAX_PATH] instead of buffer[MAX_PATH+1]. The +1 being some fudge room for a C-string null-terminator. OK, my C/C++ days are coming flooding back now, so before I get into trouble I’ll stop. :-)



  • @Alan-Kilborn

    but that is what notepad++ should do accroding to MS documents. To quote:

    In the Windows API (...), the maximum length for a path is MAX_PATH, which is defined as 260 characters.
    and further
    For example, the maximum path on drive D is "D:\some 256-character path string<NUL>" where "<NUL>" represents the invisible terminating null character for the current system codepage.

    I hope my math 3+256+NUL = 260 is now correct. :-D



  • @Ekopalypse said in Can’t open files with 103 char filenames, 259 char paths:

    Curious, can you check your LongPathsEnabled registry key from
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem ?

    No such key exists on my Windows 7 system, and I don’t believe it’s supported until Windows 10, version 1607. See:

    https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation



  • @M-Andre-Z-Eckenrode said in Can’t open files with 103 char filenames, 259 char paths:

    No such key exists on my Windows 7 system, and I don’t believe it’s supported until Windows 10, version 1607

    So then really there’s not much for you as a Win7 user to say about your original “problem”, I think. It’s a limitation of the OS, not Notepad++, that you can’t open your really-long-named files.



  • @Alan-Kilborn

    Point taken, but they were all successfully opened by the OS’ own Notepad, and most of the files >103 characters were even opened by NPP. Anyway, I’m really not hell-bent on having such long filenames and paths on my computer, but since there was considerable inconsistency, I thought there might be something else at play. Either way, it would be nice if NPP told why it couldn’t open them. Not the end of the world, of course.

    .


Log in to reply