You've already forked linux-packaging-mono
Imported Upstream version 4.8.0.309
Former-commit-id: 5f9c6ae75f295e057a7d2971f3a6df4656fa8850
This commit is contained in:
parent
ee1447783b
commit
94b2861243
@@ -86,7 +86,7 @@ namespace System.IO
|
||||
|
||||
static DirectoryInfo CreateDirectoriesInternal (string path)
|
||||
{
|
||||
#if !NET_2_1
|
||||
#if !MOBILE
|
||||
if (SecurityManager.SecurityEnabled) {
|
||||
new FileIOPermission (FileIOPermissionAccess.Read | FileIOPermissionAccess.Write, path).Demand ();
|
||||
}
|
||||
@@ -232,7 +232,7 @@ namespace System.IO
|
||||
SecurityManager.EnsureElevatedPermissions (); // this is a no-op outside moonlight
|
||||
|
||||
string result = InsecureGetCurrentDirectory();
|
||||
#if !NET_2_1
|
||||
#if !MOBILE
|
||||
if ((result != null) && (result.Length > 0) && SecurityManager.SecurityEnabled) {
|
||||
new FileIOPermission (FileIOPermissionAccess.PathDiscovery, result).Demand ();
|
||||
}
|
||||
|
||||
@@ -427,20 +427,20 @@ namespace System.IO {
|
||||
static internal IEnumerable<FileSystemInfo> EnumerateFileSystemInfos (string full, string searchPattern, SearchOption searchOption)
|
||||
{
|
||||
string path_with_pattern = Path.Combine (full, searchPattern);
|
||||
IntPtr handle;
|
||||
IntPtr handle = IntPtr.Zero;
|
||||
MonoIOError error;
|
||||
FileAttributes rattr;
|
||||
bool subdirs = searchOption == SearchOption.AllDirectories;
|
||||
|
||||
Path.Validate (full);
|
||||
|
||||
string s = MonoIO.FindFirst (full, path_with_pattern, out rattr, out error, out handle);
|
||||
if (s == null)
|
||||
yield break;
|
||||
if (error != 0)
|
||||
throw MonoIO.GetException (Path.GetDirectoryName (path_with_pattern), (MonoIOError) error);
|
||||
|
||||
try {
|
||||
string s = MonoIO.FindFirst (full, path_with_pattern, out rattr, out error, out handle);
|
||||
if (s == null)
|
||||
yield break;
|
||||
if (error != 0)
|
||||
throw MonoIO.GetException (Path.GetDirectoryName (path_with_pattern), (MonoIOError) error);
|
||||
|
||||
do {
|
||||
if (((rattr & FileAttributes.ReparsePoint) == 0)){
|
||||
if ((rattr & FileAttributes.Directory) != 0)
|
||||
@@ -455,7 +455,8 @@ namespace System.IO {
|
||||
|
||||
} while ((s = MonoIO.FindNext (handle, out rattr, out error)) != null);
|
||||
} finally {
|
||||
MonoIO.FindClose (handle);
|
||||
if (handle != IntPtr.Zero)
|
||||
MonoIO.FindClose (handle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,10 +38,7 @@ using System.Diagnostics;
|
||||
using System.Security;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
#if !NET_2_1
|
||||
using System.Security.AccessControl;
|
||||
#endif
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
@@ -147,7 +144,6 @@ namespace System.IO
|
||||
FileShare.None, bufferSize, options);
|
||||
}
|
||||
|
||||
#if !NET_2_1
|
||||
[MonoLimitation ("FileOptions and FileSecurity are ignored")]
|
||||
public static FileStream Create (string path, int bufferSize,
|
||||
FileOptions options,
|
||||
@@ -156,7 +152,6 @@ namespace System.IO
|
||||
return new FileStream (path, FileMode.Create, FileAccess.ReadWrite,
|
||||
FileShare.None, bufferSize, options);
|
||||
}
|
||||
#endif
|
||||
|
||||
public static StreamWriter CreateText (string path)
|
||||
{
|
||||
@@ -201,7 +196,6 @@ namespace System.IO
|
||||
return MonoIO.ExistsFile (path, out error);
|
||||
}
|
||||
|
||||
#if !NET_2_1
|
||||
public static FileSecurity GetAccessControl (string path)
|
||||
{
|
||||
// AccessControlSections.Audit requires special permissions.
|
||||
@@ -215,7 +209,6 @@ namespace System.IO
|
||||
{
|
||||
return new FileSecurity (path, includeSections);
|
||||
}
|
||||
#endif
|
||||
|
||||
public static FileAttributes GetAttributes (string path)
|
||||
{
|
||||
@@ -434,7 +427,6 @@ namespace System.IO
|
||||
}
|
||||
}
|
||||
|
||||
#if !NET_2_1
|
||||
public static void SetAccessControl (string path,
|
||||
FileSecurity fileSecurity)
|
||||
{
|
||||
@@ -443,7 +435,6 @@ namespace System.IO
|
||||
|
||||
fileSecurity.PersistModifications (path);
|
||||
}
|
||||
#endif
|
||||
|
||||
public static void SetAttributes (string path,
|
||||
FileAttributes fileAttributes)
|
||||
|
||||
@@ -37,17 +37,11 @@ using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using System.Security;
|
||||
using System.Security.AccessControl;
|
||||
using System.Security.Permissions;
|
||||
using System.Threading;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
#if NET_2_1
|
||||
using System.IO.IsolatedStorage;
|
||||
#else
|
||||
using System.Security.AccessControl;
|
||||
#endif
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
@@ -129,7 +123,6 @@ namespace System.IO
|
||||
Init (handle, access, false, bufferSize, isAsync, false);
|
||||
}
|
||||
|
||||
#if !MOBILE
|
||||
[MonoLimitation ("This ignores the rights parameter")]
|
||||
public FileStream (string path, FileMode mode,
|
||||
FileSystemRights rights, FileShare share,
|
||||
@@ -146,7 +139,6 @@ namespace System.IO
|
||||
: this (path, mode, (mode == FileMode.Append ? FileAccess.Write : FileAccess.ReadWrite), share, bufferSize, false, options)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
internal FileStream (string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options, string msgPath, bool bFromProxy, bool useLongPath = false, bool checkHost = false)
|
||||
: this (path, mode, access, share, bufferSize, false, options)
|
||||
@@ -176,7 +168,7 @@ namespace System.IO
|
||||
throw new ArgumentOutOfRangeException ("bufferSize", "Positive number required.");
|
||||
|
||||
if (mode < FileMode.CreateNew || mode > FileMode.Append) {
|
||||
#if NET_2_1
|
||||
#if MOBILE
|
||||
if (anonymous)
|
||||
throw new ArgumentException ("mode", "Enum value was out of legal range.");
|
||||
else
|
||||
@@ -942,7 +934,6 @@ namespace System.IO
|
||||
throw exc;
|
||||
}
|
||||
|
||||
#if !NET_2_1
|
||||
public FileSecurity GetAccessControl ()
|
||||
{
|
||||
if (safeHandle.IsClosed)
|
||||
@@ -964,7 +955,6 @@ namespace System.IO
|
||||
|
||||
fileSecurity.PersistModifications (SafeFileHandle);
|
||||
}
|
||||
#endif
|
||||
|
||||
public override Task FlushAsync (CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
#if NET_2_1
|
||||
#if MOBILE
|
||||
using System.IO.IsolatedStorage;
|
||||
#endif
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace System.IO
|
||||
return new IOException (message, unchecked((int)0x80070000) | (int)error);
|
||||
case MonoIOError.ERROR_INVALID_DRIVE:
|
||||
message = String.Format ("Could not find the drive '{0}'. The drive might not be ready or might not be mapped.", path);
|
||||
#if !NET_2_1
|
||||
#if !MOBILE
|
||||
return new DriveNotFoundException (message);
|
||||
#else
|
||||
return new IOException (message, unchecked((int)0x80070000) | (int)error);
|
||||
@@ -155,6 +155,10 @@ namespace System.IO
|
||||
case MonoIOError.ERROR_NOT_SAME_DEVICE:
|
||||
message = "Source and destination are not on the same device";
|
||||
return new IOException (message, unchecked((int)0x80070000) | (int)error);
|
||||
|
||||
case MonoIOError.ERROR_DIRECTORY:
|
||||
message = "The directory name is invalid";
|
||||
return new IOException (message, unchecked((int)0x80070000) | (int)error);
|
||||
|
||||
default:
|
||||
message = String.Format ("Win32 IO returned {0}. Path: {1}", error, path);
|
||||
|
||||
@@ -217,8 +217,8 @@ namespace System.IO
|
||||
WAIT_TIMEOUT = 258,
|
||||
ERROR_NO_MORE_ITEMS = 259,
|
||||
ERROR_CANNOT_COPY = 266,
|
||||
ERROR_DIRECTORY = 267,
|
||||
ERROR_EAS_DIDNT_FIT = 275,
|
||||
*/ ERROR_DIRECTORY = 267,
|
||||
/* ERROR_EAS_DIDNT_FIT = 275,
|
||||
ERROR_EA_FILE_CORRUPT = 276,
|
||||
ERROR_EA_TABLE_FULL = 277,
|
||||
ERROR_INVALID_EA_HANDLE = 278,
|
||||
|
||||
@@ -140,6 +140,7 @@ namespace System.IO {
|
||||
{
|
||||
int l = s.Length;
|
||||
int sub = 0;
|
||||
int alt = 0;
|
||||
int start = 0;
|
||||
|
||||
// Host prefix?
|
||||
@@ -158,6 +159,8 @@ namespace System.IO {
|
||||
|
||||
if (c != DirectorySeparatorChar && c != AltDirectorySeparatorChar)
|
||||
continue;
|
||||
if (DirectorySeparatorChar != AltDirectorySeparatorChar && c == AltDirectorySeparatorChar)
|
||||
alt++;
|
||||
if (i+1 == l)
|
||||
sub++;
|
||||
else {
|
||||
@@ -167,7 +170,7 @@ namespace System.IO {
|
||||
}
|
||||
}
|
||||
|
||||
if (sub == 0)
|
||||
if (sub == 0 && alt == 0)
|
||||
return s;
|
||||
|
||||
char [] copy = new char [l-sub];
|
||||
@@ -281,7 +284,7 @@ namespace System.IO {
|
||||
|
||||
SecurityManager.EnsureElevatedPermissions (); // this is a no-op outside moonlight
|
||||
|
||||
#if !NET_2_1
|
||||
#if !MOBILE
|
||||
if (SecurityManager.SecurityEnabled) {
|
||||
new FileIOPermission (FileIOPermissionAccess.PathDiscovery, fullpath).Demand ();
|
||||
}
|
||||
@@ -320,9 +323,12 @@ namespace System.IO {
|
||||
|
||||
internal static string WindowsDriveAdjustment (string path)
|
||||
{
|
||||
// two special cases to consider when a drive is specified
|
||||
if (path.Length < 2)
|
||||
// three special cases to consider when a drive is specified
|
||||
if (path.Length < 2) {
|
||||
if (path.Length == 1 && (path[0] == '\\' || path[0] == '/'))
|
||||
return Path.GetPathRoot(Directory.GetCurrentDirectory());
|
||||
return path;
|
||||
}
|
||||
if ((path [1] != ':') || !Char.IsLetter (path [0]))
|
||||
return path;
|
||||
|
||||
@@ -882,5 +888,7 @@ namespace System.IO {
|
||||
return DirectorySeparatorStr;
|
||||
}
|
||||
}
|
||||
|
||||
internal const int MAX_PATH = 260; // From WinDef.h
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user