Skip to content

Commit f7f224a

Browse files
authored
Enable long file paths in windows (#325)
1 parent 23341fc commit f7f224a

File tree

9 files changed

+433
-298
lines changed

9 files changed

+433
-298
lines changed

.pipelines/azure-pipelines-linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ resources:
1616
options: --entrypoint=""
1717

1818
variables:
19-
VcVersion : 1.14.32
19+
VcVersion : 1.14.33
2020
ROOT: $(Build.SourcesDirectory)
2121
CDP_DEFINITION_BUILD_COUNT: $[counter('', 0)] # needed for onebranch.pipeline.version task https://aka.ms/obpipelines/versioning
2222
ENABLE_PRS_DELAYSIGN: 1

.pipelines/azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pool:
1818
vmImage: windows-latest
1919

2020
variables:
21-
VcVersion : 1.14.32
21+
VcVersion : 1.14.33
2222
ROOT: $(Build.SourcesDirectory)
2323
CDP_DEFINITION_BUILD_COUNT: $[counter('', 0)] # needed for onebranch.pipeline.version task https://aka.ms/obpipelines/versioning
2424
ENABLE_PRS_DELAYSIGN: 1

src/VirtualClient/VirtualClient.Core/ISystemManagement.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,11 @@ public interface ISystemManagement : ISystemInfo
4747
/// Provides features for creating and managing processes on the system.
4848
/// </summary>
4949
ISshClientManager SshClientManager { get; }
50+
51+
/// <summary>
52+
/// Overwrite the default of 260 char in windows file path length to 32,767.
53+
/// https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry
54+
/// </summary>
55+
void EnableLongPathInWindows();
5056
}
5157
}

src/VirtualClient/VirtualClient.Core/SystemManagement.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,24 @@ public bool IsLocalIPAddress(string ipAddress)
245245
return isLocal;
246246
}
247247

248+
/// <summary>
249+
/// Overwrite the default of 260 char in windows file path length to 32,767.
250+
/// https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry
251+
/// </summary>
252+
public void EnableLongPathInWindows()
253+
{
254+
if (this.Platform == PlatformID.Win32NT)
255+
{
256+
const string keyPath = @"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem";
257+
258+
// Name of the DWORD value
259+
const string valueName = "LongPathsEnabled";
260+
261+
// Set the value to enable long paths
262+
Registry.SetValue(keyPath, valueName, 1, RegistryValueKind.DWord);
263+
}
264+
}
265+
248266
/// <summary>
249267
/// Causes the process to idle until the operations are cancelled.
250268
/// </summary>

0 commit comments

Comments
 (0)