Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fold System.IO.FileSystem into System.Private.CoreLib
  • Loading branch information
adamsitnik committed May 25, 2021
commit 52dab09c3eab9942ebfc8e5aea6f6558c7818112
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ internal static extern unsafe int NtQueryInformationFile(
uint Length,
uint FileInformationClass);

[StructLayout(LayoutKind.Sequential)]
internal struct IO_STATUS_BLOCK
{
private uint Status;
private IntPtr Information;
}

internal const uint FileModeInformation = 16;

internal const int STATUS_INVALID_HANDLE = unchecked((int)0xC0000008);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ namespace System.Collections.Generic
/// </summary>
internal static partial class EnumerableHelpers
{
private static int MaxArrayLength =>
#if !MS_IO_REDIST
Array.MaxLength;
#else
0X7FFFFFC7;
#endif

/// <summary>Converts an enumerable to an array using the same logic as List{T}.</summary>
/// <param name="source">The enumerable to convert.</param>
/// <param name="length">The number of items stored in the resulting array, 0-indexed.</param>
Expand Down Expand Up @@ -56,9 +63,9 @@ internal static T[] ToArray<T>(IEnumerable<T> source, out int length)
// constrain the length to be Array.MaxLength (this overflow check works because of the
// cast to uint).
int newLength = count << 1;
if ((uint)newLength > Array.MaxLength)
if ((uint)newLength > MaxArrayLength)
{
newLength = Array.MaxLength <= count ? count + 1 : Array.MaxLength;
newLength = MaxArrayLength <= count ? count + 1 : MaxArrayLength;
}

Array.Resize(ref arr, newLength);
Expand Down
50 changes: 26 additions & 24 deletions src/libraries/Microsoft.IO.Redist/src/Microsoft.IO.Redist.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,53 +8,53 @@
<IncludePlatformAttributes>true</IncludePlatformAttributes>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\System.IO.FileSystem\src\System\IO\Directory.cs"
<Compile Include="$(CoreLibSharedDir)System\IO\Directory.cs"
Link="Microsoft\IO\Directory.cs" />
<Compile Include="..\..\System.IO.FileSystem\src\System\IO\DirectoryInfo.cs"
<Compile Include="$(CoreLibSharedDir)System\IO\DirectoryInfo.cs"
Link="Microsoft\IO\DirectoryInfo.cs" />
<Compile Include="..\..\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEntry.cs"
<Compile Include="$(CoreLibSharedDir)System\IO\Enumeration\FileSystemEntry.cs"
Link="Microsoft\IO\Enumeration\FileSystemEntry.cs" />
<Compile Include="..\..\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEntry.Windows.cs"
<Compile Include="$(CoreLibSharedDir)System\IO\Enumeration\FileSystemEntry.Windows.cs"
Link="Microsoft\IO\Enumeration\FileSystemEntry.Windows.cs" />
<Compile Include="..\..\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEnumerable.cs"
<Compile Include="$(CoreLibSharedDir)System\IO\Enumeration\FileSystemEnumerable.cs"
Link="Microsoft\IO\Enumeration\FileSystemEnumerable.cs" />
<Compile Include="..\..\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEnumerableFactory.cs"
<Compile Include="$(CoreLibSharedDir)System\IO\Enumeration\FileSystemEnumerableFactory.cs"
Link="Microsoft\IO\Enumeration\FileSystemEnumerableFactory.cs" />
<Compile Include="..\..\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEnumerator.cs"
<Compile Include="$(CoreLibSharedDir)System\IO\Enumeration\FileSystemEnumerator.cs"
Link="Microsoft\IO\Enumeration\FileSystemEnumerator.cs" />
<Compile Include="..\..\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEnumerator.Win32.cs"
<Compile Include="$(CoreLibSharedDir)System\IO\Enumeration\FileSystemEnumerator.Win32.cs"
Link="Microsoft\IO\Enumeration\FileSystemEnumerator.Win32.cs" />
<Compile Include="..\..\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEnumerator.Windows.cs"
<Compile Include="$(CoreLibSharedDir)System\IO\Enumeration\FileSystemEnumerator.Windows.cs"
Link="Microsoft\IO\Enumeration\FileSystemEnumerator.Windows.cs" />
<Compile Include="..\..\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemName.cs"
<Compile Include="$(CoreLibSharedDir)System\IO\Enumeration\FileSystemName.cs"
Link="Microsoft\IO\Enumeration\FileSystemName.cs" />
<Compile Include="..\..\System.IO.FileSystem\src\System\IO\EnumerationOptions.cs"
<Compile Include="$(CoreLibSharedDir)System\IO\EnumerationOptions.cs"
Link="Microsoft\IO\EnumerationOptions.cs" />
<Compile Include="..\..\System.IO.FileSystem\src\System\IO\Error.cs"
<Compile Include="System\IO\Error.cs"
Link="Microsoft\IO\Error.cs" />
<Compile Include="..\..\System.IO.FileSystem\src\System\IO\File.cs"
<Compile Include="$(CoreLibSharedDir)System\IO\File.cs"
Link="Microsoft\IO\File.cs" />
<Compile Include="..\..\System.IO.FileSystem\src\System\IO\FileInfo.cs"
<Compile Include="$(CoreLibSharedDir)System\IO\FileInfo.cs"
Link="Microsoft\IO\FileInfo.cs" />
<Compile Include="..\..\System.IO.FileSystem\src\System\IO\FileSystem.Win32.cs"
<Compile Include="$(CoreLibSharedDir)System\IO\FileSystem.Win32.cs"
Link="Microsoft\IO\FileSystem.Win32.cs" />
<Compile Include="..\..\System.IO.FileSystem\src\System\IO\FileSystem.Windows.cs"
<Compile Include="$(CoreLibSharedDir)System\IO\FileSystem.Windows.cs"
Link="Microsoft\IO\FileSystem.Windows.cs" />
<Compile Include="..\..\System.IO.FileSystem\src\System\IO\FileSystemInfo.cs"
<Compile Include="$(CoreLibSharedDir)System\IO\FileSystemInfo.cs"
Link="Microsoft\IO\FileSystemInfo.cs" />
<Compile Include="..\..\System.IO.FileSystem\src\System\IO\FileSystemInfo.Windows.cs"
<Compile Include="$(CoreLibSharedDir)System\IO\FileSystemInfo.Windows.cs"
Link="Microsoft\IO\FileSystemInfo.Windows.cs" />
<Compile Include="..\..\System.IO.FileSystem\src\System\IO\Iterator.cs"
<Compile Include="$(CoreLibSharedDir)System\IO\Iterator.cs"
Link="Microsoft\IO\Iterator.cs" />
<Compile Include="..\..\System.IO.FileSystem\src\System\IO\MatchCasing.cs"
<Compile Include="$(CoreLibSharedDir)System\IO\MatchCasing.cs"
Link="Microsoft\IO\MatchCasing.cs" />
<Compile Include="..\..\System.IO.FileSystem\src\System\IO\MatchType.cs"
<Compile Include="$(CoreLibSharedDir)System\IO\MatchType.cs"
Link="Microsoft\IO\MatchType.cs" />
<Compile Include="..\..\System.IO.FileSystem\src\System\IO\ReadLinesIterator.cs"
<Compile Include="$(CoreLibSharedDir)System\IO\ReadLinesIterator.cs"
Link="Microsoft\IO\ReadLinesIterator.cs" />
<Compile Include="..\..\System.IO.FileSystem\src\System\IO\SearchOption.cs"
<Compile Include="$(CoreLibSharedDir)System\IO\SearchOption.cs"
Link="Microsoft\IO\SearchOption.cs" />
<Compile Include="..\..\System.IO.FileSystem\src\System\IO\SearchTarget.cs"
<Compile Include="$(CoreLibSharedDir)System\IO\SearchTarget.cs"
Link="Microsoft\IO\SearchTarget.cs" />
<Compile Include="$(CommonPath)Interop\Windows\BCrypt\Interop.BCryptGenRandom.cs"
Link="Interop\Windows\BCrypt\Interop.BCryptGenRandom.cs" />
Expand Down Expand Up @@ -192,6 +192,8 @@
Link="Common\System\IO\PathInternal.CaseSensitivity.cs" />
<Compile Include="$(CommonPath)System\Memory\FixedBufferExtensions.cs"
Link="Common\System\Memory\FixedBufferExtensions.cs" />
<Compile Include="$(CommonPath)System\Collections\Generic\EnumerableHelpers.cs"
Link="Common\System\Collections\Generic\EnumerableHelpers.cs" />
<Compile Include="$(CoreLibSharedDir)System\Runtime\InteropServices\SuppressGCTransitionAttribute.cs"
Link="System\Runtime\InteropServices\SuppressGCTransitionAttribute.cs" />
<Compile Include="Microsoft\IO\StringExtensions.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\System.ComponentModel\ref\System.ComponentModel.csproj" />
<ProjectReference Include="..\..\System.IO.FileSystem\ref\System.IO.FileSystem.csproj" />
<ProjectReference Include="..\..\System.IO.FileSystem.DriveInfo\ref\System.IO.FileSystem.DriveInfo.csproj" />
<ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" />
<ProjectReference Include="..\..\System.Runtime.Extensions\ref\System.Runtime.Extensions.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
<ItemGroup>
<ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" />
<ProjectReference Include="..\..\System.IO.FileSystem.Primitives\ref\System.IO.FileSystem.Primitives.csproj" />
<ProjectReference Include="..\..\System.IO.FileSystem\ref\System.IO.FileSystem.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,17 @@
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.Win32.SafeHandles.SafeFileHandle))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.IO.FileOptions))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.IO.FileStream))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.IO.Directory))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.IO.DirectoryInfo))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.IO.EnumerationOptions))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.IO.File))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.IO.FileInfo))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.IO.FileSystemInfo))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.IO.MatchCasing))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.IO.MatchType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.IO.SearchOption))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.IO.Enumeration.FileSystemEntry))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.IO.Enumeration.FileSystemEnumerable<>))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.IO.Enumeration.FileSystemEnumerator<>))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.IO.Enumeration.FileSystemName))]

Loading