Skip to content

Commit 829ab9d

Browse files
committed
1 parent 6073275 commit 829ab9d

File tree

4 files changed

+43
-0
lines changed

4 files changed

+43
-0
lines changed

.github/workflows/ci.yml

+5
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ jobs:
8787
echo.%GIT_REF_TAG% | findstr /C:"%target_ruby%">nul || (echo stop build not required for release & (exit 1))
8888
)
8989
90+
- name: enable long paths on OS level
91+
shell: powershell
92+
# https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=powershell
93+
run: New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
94+
9095
- name: ensure bundler is installed on the build ruby
9196
run: gem install bundler --conservative --no-doc
9297

appveyor.yml

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ init:
1010
- IF DEFINED DEPLOY_TAG (
1111
echo.%DEPLOY_TAG% | findstr /C:"%target_ruby%">nul || (echo stop build not required for release & (exit 1))
1212
)
13+
# enable long paths on OS level:
14+
# https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=powershell
15+
- powershell New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
1316

1417
install:
1518
# Avoid repo.msys2.org since it's down currently

recipes/sandbox/60-side-by-side-assembly.rake

+5
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ end.each do |destpath|
3535
image = File.binread(t.prerequisites.first)
3636
# The XML elements we want to add to the default MINGW manifest:
3737
new = <<-EOT
38+
<application xmlns="urn:schemas-microsoft-com:asm.v3">
39+
<windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
40+
<ws2:longPathAware>true</ws2:longPathAware>
41+
</windowsSettings>
42+
</application>
3843
<dependency>
3944
<dependentAssembly>
4045
<assemblyIdentity version="1.0.0.0" type="win32" name="ruby_builtin_dlls" />

test/test_long_path.rb

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#frozen_string_literal: true
2+
require "minitest/autorun"
3+
require "tmpdir"
4+
5+
class TestStdlib < Minitest::Test
6+
LONG_PATH = Dir.mktmpdir("0123456789"*15)
7+
8+
def test_mkdir
9+
n = File.join(LONG_PATH, "c"*150)
10+
Dir.mkdir n
11+
assert Dir.exist?(n)
12+
assert_operator 260, :<, n.size
13+
end
14+
15+
def test_file_rw
16+
n = File.join(LONG_PATH, "d"*150)
17+
File.write n, "abc"
18+
assert_equal "abc", File.read(n)
19+
assert File.exist?(n)
20+
assert_operator 260, :<, n.size
21+
end
22+
23+
def test_load
24+
n = File.join(LONG_PATH, "e"*150 + ".rb")
25+
File.write n, "def loaded_a; 41; end"
26+
assert load(n)
27+
assert_equal 41, loaded_a
28+
assert_operator 260, :<, n.size
29+
end
30+
end

0 commit comments

Comments
 (0)