What is the path or file name length limitation?

KiCad Save Error message January 18 2021a

I am “dipping my toes” into a newer 5.99 version. I have some home projects which were done with 5.1 and opened this one with 5.99. I thought I had hit a bug (or intentional limitation) with the new 5.99 which was not present in 5.99 from August. But I encountered same issue using either. I use the same name for the base folder and all of the KiCad files in it. On a hunch, I shortened the name of the folder and all the files. This seemed to eliminate the problem. What limit did I hit?

I believe Windows has (had?) a maximum path length of 260 characters.

Maximum Path Length Limitation

In editions of Windows before Windows 10 version 1607, the maximum length for a path is MAX_PATH , which is defined as 260 characters. In later versions of Windows, changing a registry key or using the Group Policy tool is required to remove the limit. See Maximum Path Length Limitation for full details.

In the Windows API (with some exceptions discussed in the following paragraphs), the maximum length for a path is MAX_PATH , which is defined as 260 characters. A local path is structured in the following order: drive letter, colon, backslash, name components separated by backslashes, and a terminating null character. For example, the maximum path on drive D is "D:\ some 256-character path string " where “” represents the invisible terminating null character for the current system codepage. (The characters < > are used here for visual clarity and cannot be part of a valid path string.)

For example, you may hit this limitation if you are cloning a git repo that has long file names into a folder that itself has a long name.

you could try enabling LongPath support

Starting in Windows 10, version 1607, MAX_PATH limitations have been removed from common Win32 file and directory functions. However, you must opt-in to the new behavior.

To enable the new long path behavior, both of the following conditions must be met:

  • The registry key Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled (Type: REG_DWORD) must exist and be set to 1. The key’s value will be cached by the system (per process) after the first call to an affected Win32 file or directory function (see below for the list of functions). The registry key will not be reloaded during the lifetime of the process. In order for all apps on the system to recognize the value of the key, a reboot might be required because some processes may have started before the key was set.

Or accessing it via UNC via prefixing *\?*

Thank you very much for the responses. I am much more of a hardware person than a software person. In this case my file name was longer than needed in at least 2 ways. It was easy to shorten it Nothing like a little shortening for ideas which are half baked. :slight_smile: This had me scratching my bald head a bit. I was more aware of limitations to file names than to limitations in characters in the entire path. This is good to know.