Imported Upstream version 6.0.0.172

Former-commit-id: f3cc9b82f3e5bd8f0fd3ebc098f789556b44e9cd
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-04-12 14:10:50 +00:00
parent 8016999e4d
commit 64ac736ec5
32155 changed files with 3981439 additions and 75368 deletions

View File

@@ -159,7 +159,7 @@ namespace System.IO {
case Win32Native.ERROR_ALREADY_EXISTS:
if (str.Length == 0)
goto default;
throw new IOException(Environment.GetResourceString("IO.IO_AlreadyExists_Name", str), Win32Native.MakeHRFromErrorCode(errorCode), maybeFullPath);
throw new IOException(Environment.GetResourceString("IO.IO_AlreadyExists_Name", str), Win32Native.MakeHRFromErrorCode(errorCode));
case Win32Native.ERROR_FILENAME_EXCED_RANGE:
throw new PathTooLongException(Environment.GetResourceString("IO.PathTooLong"));
@@ -168,24 +168,24 @@ namespace System.IO {
throw new DriveNotFoundException(Environment.GetResourceString("IO.DriveNotFound_Drive", str));
case Win32Native.ERROR_INVALID_PARAMETER:
throw new IOException(Win32Native.GetMessage(errorCode), Win32Native.MakeHRFromErrorCode(errorCode), maybeFullPath);
throw new IOException(Win32Native.GetMessage(errorCode), Win32Native.MakeHRFromErrorCode(errorCode));
case Win32Native.ERROR_SHARING_VIOLATION:
if (str.Length == 0)
throw new IOException(Environment.GetResourceString("IO.IO_SharingViolation_NoFileName"), Win32Native.MakeHRFromErrorCode(errorCode), maybeFullPath);
throw new IOException(Environment.GetResourceString("IO.IO_SharingViolation_NoFileName"), Win32Native.MakeHRFromErrorCode(errorCode));
else
throw new IOException(Environment.GetResourceString("IO.IO_SharingViolation_File", str), Win32Native.MakeHRFromErrorCode(errorCode), maybeFullPath);
throw new IOException(Environment.GetResourceString("IO.IO_SharingViolation_File", str), Win32Native.MakeHRFromErrorCode(errorCode));
case Win32Native.ERROR_FILE_EXISTS:
if (str.Length == 0)
goto default;
throw new IOException(Environment.GetResourceString("IO.IO_FileExists_Name", str), Win32Native.MakeHRFromErrorCode(errorCode), maybeFullPath);
throw new IOException(Environment.GetResourceString("IO.IO_FileExists_Name", str), Win32Native.MakeHRFromErrorCode(errorCode));
case Win32Native.ERROR_OPERATION_ABORTED:
throw new OperationCanceledException();
default:
throw new IOException(Win32Native.GetMessage(errorCode), Win32Native.MakeHRFromErrorCode(errorCode), maybeFullPath);
throw new IOException(Win32Native.GetMessage(errorCode), Win32Native.MakeHRFromErrorCode(errorCode));
}
}
#if !MONO

View File

@@ -254,7 +254,7 @@ namespace System.IO {
[ResourceConsumption(ResourceScope.Machine)]
public StreamReader OpenText()
{
return new StreamReader(FullPath, Encoding.UTF8, true, StreamReader.DefaultBufferSize, false);
return new StreamReader(FullPath, Encoding.UTF8, detectEncodingFromByteOrderMarks: true);
}
[ResourceExposure(ResourceScope.Machine)]

View File

@@ -794,7 +794,7 @@ namespace System.IO
FileIOPermission.QuickDemand(FileIOPermissionAccess.Read, permissionName, false, false);
#endif
#endif
DirectoryInfo di = new DirectoryInfo(name, false);
DirectoryInfo di = new DirectoryInfo(Path.GetFileName(name), fullPath: name, isNormalized: true);
di.InitializeFrom(result.FindData);
return di;
}
@@ -833,7 +833,7 @@ namespace System.IO
FileIOPermission.QuickDemand(FileIOPermissionAccess.Read, permissionName, false, false);
#endif
#endif
DirectoryInfo di = new DirectoryInfo(name, false);
DirectoryInfo di = new DirectoryInfo(Path.GetFileName(name), fullPath: name, isNormalized: true);
di.InitializeFrom(result.FindData);
return di;
}