[前][次][番号順一覧][スレッド一覧]

ruby-changes:66214

From: Gabriel <ko1@a...>
Date: Mon, 17 May 2021 08:33:27 +0900 (JST)
Subject: [ruby-changes:66214] 229cb0fcdb (master): [Win32] long path name support [Bug #12551]

https://git.ruby-lang.org/ruby.git/commit/?id=229cb0fcdb

From 229cb0fcdb7957b19d7042b000d803ae58cc6593 Mon Sep 17 00:00:00 2001
From: Gabriel Nagy <gabrielnagy@m...>
Date: Mon, 17 May 2021 02:33:08 +0300
Subject: [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@r...>
---
 test/ruby/test_process.rb | 1 +
 win32/resource.rb         | 2 +-
 win32/ruby.manifest       | 8 ++++++++
 3 files changed, 10 insertions(+), 1 deletion(-)
 create mode 100644 win32/ruby.manifest

diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb
index 33144aa..0493544 100644
--- a/test/ruby/test_process.rb
+++ b/test/ruby/test_process.rb
@@ -1771,6 +1771,7 @@ class TestProcess < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L1771
     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)
diff --git a/win32/resource.rb b/win32/resource.rb
index e19e04b..bc3eda5 100755
--- a/win32/resource.rb
+++ b/win32/resource.rb
@@ -61,6 +61,7 @@ end https://github.com/ruby/ruby/blob/trunk/win32/resource.rb#L61
 #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 https://github.com/ruby/ruby/blob/trunk/win32/resource.rb#L94
 EOF
   }
 end
-
diff --git a/win32/ruby.manifest b/win32/ruby.manifest
new file mode 100644
index 0000000..2bd4959
--- /dev/null
+++ b/win32/ruby.manifest
@@ -0,0 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/win32/ruby.manifest#L1
+<?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>
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]