1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[Win32] long path name support [Bug #12551]

Implement long path support on Windows by applying Microsoft's
recommended application manifest.

To make this work on both Visual C++ and MinGW, include the manifest as
a resource when generating the resource files. This way it will be
embedded into the executables generated by both compilers.

It's important for the manifest resource to have ID 1, otherwise GCC
will embed a default manifest.

Note that in addition to this, the user needs to have [long paths enabled]
either by modifying the registry or by enabling a group policy.

[long paths enabled]: https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd#enable-long-paths-in-windows-10-version-1607-and-later

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
This commit is contained in:
Gabriel Nagy 2021-05-17 02:33:08 +03:00 committed by GitHub
parent adafa8105f
commit 229cb0fcdb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
Notes: git 2021-05-17 08:33:44 +09:00
Merged: https://github.com/ruby/ruby/pull/4505

Merged-By: nobu <nobu@ruby-lang.org>
3 changed files with 10 additions and 1 deletions

View file

@ -1771,6 +1771,7 @@ class TestProcess < Test::Unit::TestCase
min = 1_000 / (cmd.size + sep.size)
cmds = Array.new(min, cmd)
exs = [Errno::ENOENT]
exs << Errno::EINVAL if windows?
exs << Errno::E2BIG if defined?(Errno::E2BIG)
opts = {[STDOUT, STDERR]=>File::NULL}
opts[:rlimit_nproc] = 128 if defined?(Process::RLIMIT_NPROC)

View file

@ -61,6 +61,7 @@ end
#include <winver.h>
#{icon || ''}
#{type == 'VFT_APP' ? "1 RT_MANIFEST ruby.manifest" : ""}
VS_VERSION_INFO VERSIONINFO
FILEVERSION #{nversion}
PRODUCTVERSION #{nversion}
@ -93,4 +94,3 @@ END
EOF
}
end

8
win32/ruby.manifest Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<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>