-
Notifications
You must be signed in to change notification settings - Fork 5.3k
WASM: Fix System.IO.FileSystem.DriveInfo and Microsoft.VisualBasic.Core tests #39276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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"; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see "memfs" is a node.js plugin. Is this the value that I would get in the browser context, where node.js is not present - would that be confusing?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| public long AvailableFreeSpace => 0; | ||
| public long TotalFreeSpace => 0; | ||
| public long TotalSize => 0; | ||
|
|
||
| private static string[] GetMountPoints() => Environment.GetLogicalDrives(); | ||
| } | ||
| } | ||
| 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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Incidentally I think this comment is out of date and
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah looks like it is outdated but since this is preexisting code I'll leave the cleanup to later on :) |
||
| { | ||
| 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(); | ||
| } | ||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, this is due to a limitation in the libc that we use in browser?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.