Long Path Error in Windows #866
|
Windows have a max file path character length of 260 characters. Since SDKs are auto-generated and file paths follow OPENAPI paths, with nesting in most cases, the file path can grow into a path with more than the required 260 characters. e.g: msgraph-sdk-python/msgraph/generated/communications/call_records/microsoft_graph_call_records_get_direct_routing_calls_with_from_date_time_with_to_date_time.py msgraph-sdk-python/msgraph/generated/communications/call_records/microsoft_graph_call_records_get_pstn_calls_with_from_date_time_with_to_date_time.py How do we go about this? |
Replies: 2 comments
|
Since parts of the SDK are auto-generated and paths are formed based on the OpenAPI tree node, which could be nested, some entities also have long names leading to many characters in the SDK.
#!/bin/bash
# Enable long paths
# set the value of LongPathsEnabled to 1
REG_PATH="HKLM\\SYSTEM\\CurrentControlSet\\Control\\FileSystem"
KEY_NAME="LongPathsEnabled"
# Use reg.exe to add the LongPathsEnabled key with a value of 1
reg.exe add "$REG_PATH" /v "$KEY_NAME" /t REG_DWORD /d 1 /f
echo "Long file paths enabled."
|
|
Even with longPathsEnabled this creates error. A lot of windows app, most notably the windows explorer do not use that registry key as you could expect. the 'auto generated' files excuse is also no good, the devs should keep to a short naming convention. |
Since parts of the SDK are auto-generated and paths are formed based on the OpenAPI tree node, which could be nested, some entities also have long names leading to many characters in the SDK.
Renaming/abbreviating file and folder names to shorten them - while this seems like a feasible solution, it can lead to path collissions as we will nolonger use fully qualified paths but short forms.
Enable long file paths in your developer machine:
`
Open the Registry Editor by typing "regedit" in the Windows search bar and pressing Enter.
Navigate to the following path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem.
Find the entry named LongPathsEnabled. If it does not ex…