forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WASM: Fix System.IO.FileSystem.DriveInfo and Microsoft.VisualBasic.Co…
…re tests (dotnet#39276) * WASM: Fix System.IO.FileSystem.DriveInfo * WASM: Fix Microsoft.VisualBasic.Core tests Some tests need culture data. * Fix test that was accidentally reversed for non-Browser
- Loading branch information
1 parent
142021c
commit d9b7f4e
Showing
11 changed files
with
115 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/libraries/System.IO.FileSystem.DriveInfo/src/System/IO/DriveInfo.Browser.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Collections.Generic; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Security; | ||
|
||
namespace System.IO | ||
{ | ||
public sealed partial class DriveInfo | ||
{ | ||
public DriveType DriveType => DriveType.Unknown; | ||
public string DriveFormat => "memfs"; | ||
public long AvailableFreeSpace => 0; | ||
public long TotalFreeSpace => 0; | ||
public long TotalSize => 0; | ||
|
||
private static string[] GetMountPoints() => Environment.GetLogicalDrives(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
src/libraries/System.IO.FileSystem.DriveInfo/src/System/IO/DriveInfo.UnixOrBrowser.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Collections.Generic; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Security; | ||
|
||
namespace System.IO | ||
{ | ||
public sealed partial class DriveInfo | ||
{ | ||
public static DriveInfo[] GetDrives() | ||
{ | ||
string[] mountPoints = GetMountPoints(); | ||
DriveInfo[] info = new DriveInfo[mountPoints.Length]; | ||
for (int i = 0; i < info.Length; i++) | ||
{ | ||
info[i] = new DriveInfo(mountPoints[i]); | ||
} | ||
|
||
return info; | ||
} | ||
|
||
private static string NormalizeDriveName(string driveName) | ||
{ | ||
if (driveName.Contains("\0")) // string.Contains(char) is .NetCore2.1+ specific | ||
{ | ||
throw new ArgumentException(SR.Format(SR.Arg_InvalidDriveChars, driveName), nameof(driveName)); | ||
} | ||
if (driveName.Length == 0) | ||
{ | ||
throw new ArgumentException(SR.Arg_MustBeNonEmptyDriveName, nameof(driveName)); | ||
} | ||
return driveName; | ||
} | ||
|
||
[AllowNull] | ||
public string VolumeLabel | ||
{ | ||
get | ||
{ | ||
return Name; | ||
} | ||
set | ||
{ | ||
throw new PlatformNotSupportedException(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters