Windows: command line applications: embed manifest to declare longPathAware=true property (fixes #5836)

This also requires the operating system to accept long paths, by setting
a LongPathsEnabled registry key to 1, e.g with the following Powershell command:
```
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
```

See https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=powershell#enable-long-paths-in-windows-10-version-1607-and-later
This commit is contained in:
Even Rouault 2022-06-01 15:41:12 +02:00
parent e615c4533a
commit f434df6e24
No known key found for this signature in database
GPG Key ID: 33EBBFC47B3DD87D
2 changed files with 13 additions and 0 deletions

View File

@ -109,6 +109,9 @@ if (BUILD_APPS)
add_custom_target(gdalapps DEPENDS ${APPS_TARGETS})
foreach (UTILCMD IN ITEMS ${APPS_TARGETS})
if (WIN32)
target_sources(${UTILCMD} PRIVATE longpathaware.manifest)
endif()
# Add that include directory before all others so the gdal_version.h from it is included and not
# gcore/gdal_version.h
target_include_directories(${UTILCMD} PRIVATE $<TARGET_PROPERTY:gcore,BINARY_DIR>/gdal_version_full)
@ -153,6 +156,9 @@ if (BUILD_APPS)
multireadtest
test_ogrsf
testreprojmulti)
if (WIN32)
target_sources(${UTILCMD} PRIVATE longpathaware.manifest)
endif()
# Add that include directory before all others so the gdal_version.h from it is included and not
# gcore/gdal_version.h
target_include_directories(${UTILCMD} PRIVATE $<TARGET_PROPERTY:gcore,BINARY_DIR>/gdal_version_full)

View File

@ -0,0 +1,7 @@
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
<ws2:longPathAware>true</ws2:longPathAware>
</windowsSettings>
</application>
</assembly>