File name truncated in external editor call

Advertisement

Guest

File name truncated in external editor call

Hello,

it seems that for any external editor, the "!.!" part of the command line is limited to 100 characters, so it is possible to open a file called "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", but a file called "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901" (i.e. with 1 more character) will not be opened because the editor receives the filename "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890". No joke, I actually have to deal with such long filenames :-)

The problem doesn't occur in the internal editor.

Regards

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,286
Location:
Prague, Czechia

Re: File name truncated in external editor call

Thanks for your report. Though I cannot reproduce your problem. I can edit files with even twice as long name. What external editor is that? What version of Windows? How do you check what file name does the editor receive? Did you check it in the Task Manager?

Reply with quote

Guest

I checked the command line as you suggested, but it is not truncated in Process Explorer. I also can open an identically named file when it is in a less deeply nested directory (e.g. C:\Temp). It seems that the apparent limit of 100 was just a conincidence, because when I try to reproduce the problem from WinSCP now, it is 111, maybe because I used a different remote directory then. The actual limit is probably the whole path length, which hit 260 (=MAX_PATH, cf. https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation). I have set the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled to 1 to enable longer paths, which might also play a role.

So I suppose that the actual problem lies with both editors using an older API which doesn't support long file names, not with WinSCP.

Reply with quote

bst
Joined:
Posts:
1

(Forgot to login before)

Another note: When I use the Notepad++ shell extension to open the file with "Edit with Notepad++", it automatically falls back to DOS-compatible shortened paths ("123456~1" etc.) when the whole file path exceeds 260 characters. Not sure if this is Notepad++ or Windows behaviour, though.

Reply with quote

Advertisement

You can post new topics in this forum