Imported Upstream version 6.0.0.183
Former-commit-id: 52d866fe5c7f8a1e61b372993391b8bfdfac2bd0
This commit is contained in:
parent
7aefecd37c
commit
82da664f86
@ -1 +1 @@
|
|||||||
72075fe503f90a8c9087954fd13cae555b0fd10e
|
a33544e2256923c827809cd431f436b0559a226e
|
@ -1 +1 @@
|
|||||||
5cf967df968a4cd55c0acb463f01a9a4b019cee0
|
fca4cfccc556dbb274d1a351bbe332106a661be0
|
@ -29,6 +29,64 @@ namespace System.IO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void LinkOrCopyFile (string sourceFullPath, string destFullPath)
|
||||||
|
{
|
||||||
|
if (Interop.Sys.Link(sourceFullPath, destFullPath) >= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// If link fails, we can fall back to doing a full copy, but we'll only do so for
|
||||||
|
// cases where we expect link could fail but such a copy could succeed. We don't
|
||||||
|
// want to do so for all errors, because the copy could incur a lot of cost
|
||||||
|
// even if we know it'll eventually fail, e.g. EROFS means that the source file
|
||||||
|
// system is read-only and couldn't support the link being added, but if it's
|
||||||
|
// read-only, then the move should fail any way due to an inability to delete
|
||||||
|
// the source file.
|
||||||
|
Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo();
|
||||||
|
if (errorInfo.Error == Interop.Error.EXDEV || // rename fails across devices / mount points
|
||||||
|
errorInfo.Error == Interop.Error.EACCES ||
|
||||||
|
errorInfo.Error == Interop.Error.EPERM || // permissions might not allow creating hard links even if a copy would work
|
||||||
|
errorInfo.Error == Interop.Error.EOPNOTSUPP || // links aren't supported by the source file system
|
||||||
|
errorInfo.Error == Interop.Error.EMLINK || // too many hard links to the source file
|
||||||
|
errorInfo.Error == Interop.Error.ENOSYS) // the file system doesn't support link
|
||||||
|
{
|
||||||
|
CopyFile(sourceFullPath, destFullPath, overwrite: false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// The operation failed. Within reason, try to determine which path caused the problem
|
||||||
|
// so we can throw a detailed exception.
|
||||||
|
string path = null;
|
||||||
|
bool isDirectory = false;
|
||||||
|
if (errorInfo.Error == Interop.Error.ENOENT)
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(Path.GetDirectoryName(destFullPath)))
|
||||||
|
{
|
||||||
|
// The parent directory of destFile can't be found.
|
||||||
|
// Windows distinguishes between whether the directory or the file isn't found,
|
||||||
|
// and throws a different exception in these cases. We attempt to approximate that
|
||||||
|
// here; there is a race condition here, where something could change between
|
||||||
|
// when the error occurs and our checks, but it's the best we can do, and the
|
||||||
|
// worst case in such a race condition (which could occur if the file system is
|
||||||
|
// being manipulated concurrently with these checks) is that we throw a
|
||||||
|
// FileNotFoundException instead of DirectoryNotFoundexception.
|
||||||
|
path = destFullPath;
|
||||||
|
isDirectory = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
path = sourceFullPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (errorInfo.Error == Interop.Error.EEXIST)
|
||||||
|
{
|
||||||
|
path = destFullPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw Interop.GetExceptionForIoErrno(errorInfo, path, isDirectory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void ReplaceFile(string sourceFullPath, string destFullPath, string destBackupFullPath, bool ignoreMetadataErrors)
|
public static void ReplaceFile(string sourceFullPath, string destFullPath, string destBackupFullPath, bool ignoreMetadataErrors)
|
||||||
{
|
{
|
||||||
if (destBackupFullPath != null)
|
if (destBackupFullPath != null)
|
||||||
@ -46,7 +104,7 @@ namespace System.IO
|
|||||||
|
|
||||||
// Now that the backup is gone, link the backup to point to the same file as destination.
|
// Now that the backup is gone, link the backup to point to the same file as destination.
|
||||||
// This way, we don't lose any data in the destination file, no copy is necessary, etc.
|
// This way, we don't lose any data in the destination file, no copy is necessary, etc.
|
||||||
Interop.CheckIo(Interop.Sys.Link(destFullPath, destBackupFullPath), destFullPath);
|
LinkOrCopyFile(destFullPath, destBackupFullPath);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -88,58 +146,7 @@ namespace System.IO
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Interop.Sys.Link(sourceFullPath, destFullPath) < 0)
|
LinkOrCopyFile(sourceFullPath, destFullPath);
|
||||||
{
|
|
||||||
// If link fails, we can fall back to doing a full copy, but we'll only do so for
|
|
||||||
// cases where we expect link could fail but such a copy could succeed. We don't
|
|
||||||
// want to do so for all errors, because the copy could incur a lot of cost
|
|
||||||
// even if we know it'll eventually fail, e.g. EROFS means that the source file
|
|
||||||
// system is read-only and couldn't support the link being added, but if it's
|
|
||||||
// read-only, then the move should fail any way due to an inability to delete
|
|
||||||
// the source file.
|
|
||||||
Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo();
|
|
||||||
if (errorInfo.Error == Interop.Error.EXDEV || // rename fails across devices / mount points
|
|
||||||
errorInfo.Error == Interop.Error.EPERM || // permissions might not allow creating hard links even if a copy would work
|
|
||||||
errorInfo.Error == Interop.Error.EOPNOTSUPP || // links aren't supported by the source file system
|
|
||||||
errorInfo.Error == Interop.Error.EMLINK || // too many hard links to the source file
|
|
||||||
errorInfo.Error == Interop.Error.ENOSYS) // the file system doesn't support link
|
|
||||||
{
|
|
||||||
CopyFile(sourceFullPath, destFullPath, overwrite: false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// The operation failed. Within reason, try to determine which path caused the problem
|
|
||||||
// so we can throw a detailed exception.
|
|
||||||
string path = null;
|
|
||||||
bool isDirectory = false;
|
|
||||||
if (errorInfo.Error == Interop.Error.ENOENT)
|
|
||||||
{
|
|
||||||
if (!Directory.Exists(Path.GetDirectoryName(destFullPath)))
|
|
||||||
{
|
|
||||||
// The parent directory of destFile can't be found.
|
|
||||||
// Windows distinguishes between whether the directory or the file isn't found,
|
|
||||||
// and throws a different exception in these cases. We attempt to approximate that
|
|
||||||
// here; there is a race condition here, where something could change between
|
|
||||||
// when the error occurs and our checks, but it's the best we can do, and the
|
|
||||||
// worst case in such a race condition (which could occur if the file system is
|
|
||||||
// being manipulated concurrently with these checks) is that we throw a
|
|
||||||
// FileNotFoundException instead of DirectoryNotFoundexception.
|
|
||||||
path = destFullPath;
|
|
||||||
isDirectory = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
path = sourceFullPath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (errorInfo.Error == Interop.Error.EEXIST)
|
|
||||||
{
|
|
||||||
path = destFullPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw Interop.GetExceptionForIoErrno(errorInfo, path, isDirectory);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DeleteFile(sourceFullPath);
|
DeleteFile(sourceFullPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ static partial class Consts
|
|||||||
// Use these assembly version constants to make code more maintainable.
|
// Use these assembly version constants to make code more maintainable.
|
||||||
//
|
//
|
||||||
|
|
||||||
public const string MonoVersion = "6.0.0.176";
|
public const string MonoVersion = "6.0.0.183";
|
||||||
public const string MonoCompany = "Mono development team";
|
public const string MonoCompany = "Mono development team";
|
||||||
public const string MonoProduct = "Mono Common Language Infrastructure";
|
public const string MonoProduct = "Mono Common Language Infrastructure";
|
||||||
public const string MonoCopyright = "(c) Various Mono authors";
|
public const string MonoCopyright = "(c) Various Mono authors";
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
../../../mono/mini/basic-float.cs
|
../../../mono/mini/basic-float.cs
|
||||||
../../../mono/mini/basic-long.cs
|
../../../mono/mini/basic-long.cs
|
||||||
../../../mono/mini/basic-math.cs
|
../../../mono/mini/basic-math.cs
|
||||||
../../../mono/mini/basic-simd.cs
|
|
||||||
../../../mono/mini/basic-vectors.cs
|
../../../mono/mini/basic-vectors.cs
|
||||||
../../../mono/mini/basic.cs
|
../../../mono/mini/basic.cs
|
||||||
../../../mono/mini/bench.cs
|
../../../mono/mini/bench.cs
|
||||||
|
@ -9,8 +9,12 @@ include ../../build/rules.make
|
|||||||
LIBRARY = Mono.Runtime.Tests.dll
|
LIBRARY = Mono.Runtime.Tests.dll
|
||||||
NO_BUILD = 1
|
NO_BUILD = 1
|
||||||
NO_INSTALL = 1
|
NO_INSTALL = 1
|
||||||
LIB_REFS = System System.Core System.Numerics System.Numerics.Vectors Mono.Simd
|
LIB_REFS = System System.Core System.Numerics System.Numerics.Vectors
|
||||||
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -unsafe -d:__MOBILE__ -nowarn:CS0169,CS0649,CS0414,CS0618,CS0219,CS0168
|
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -unsafe -d:__MOBILE__ -nowarn:CS0169,CS0649,CS0414,CS0618,CS0219,CS0168
|
||||||
|
|
||||||
|
ifneq ($(PROFILE),monodroid)
|
||||||
|
LIB_REFS += Mono.Simd
|
||||||
|
endif
|
||||||
|
|
||||||
include ../../build/library.make
|
include ../../build/library.make
|
||||||
|
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
../../../../mono/mini/basic-simd.cs
|
@ -1071,7 +1071,7 @@ namespace System.Windows.Forms
|
|||||||
return TreeView.ImageList.Images.IndexOfKey (selected_image_key);
|
return TreeView.ImageList.Images.IndexOfKey (selected_image_key);
|
||||||
if (!string.IsNullOrEmpty (TreeView.SelectedImageKey))
|
if (!string.IsNullOrEmpty (TreeView.SelectedImageKey))
|
||||||
return TreeView.ImageList.Images.IndexOfKey (TreeView.SelectedImageKey);
|
return TreeView.ImageList.Images.IndexOfKey (TreeView.SelectedImageKey);
|
||||||
if (TreeView.SelectedImageIndex >= 0)
|
if (selected_image_index == -1 && TreeView.SelectedImageIndex >= 0)
|
||||||
return TreeView.SelectedImageIndex;
|
return TreeView.SelectedImageIndex;
|
||||||
} else {
|
} else {
|
||||||
if (image_index >= 0)
|
if (image_index >= 0)
|
||||||
@ -1080,12 +1080,9 @@ namespace System.Windows.Forms
|
|||||||
return TreeView.ImageList.Images.IndexOfKey (image_key);
|
return TreeView.ImageList.Images.IndexOfKey (image_key);
|
||||||
if (!string.IsNullOrEmpty (TreeView.ImageKey))
|
if (!string.IsNullOrEmpty (TreeView.ImageKey))
|
||||||
return TreeView.ImageList.Images.IndexOfKey (TreeView.ImageKey);
|
return TreeView.ImageList.Images.IndexOfKey (TreeView.ImageKey);
|
||||||
if (TreeView.ImageIndex >= 0)
|
if (image_index == -1 && TreeView.ImageIndex >= 0)
|
||||||
return TreeView.ImageIndex;
|
return TreeView.ImageIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TreeView.ImageList.Images.Count > 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -923,7 +923,7 @@ namespace MonoTests.System.IO
|
|||||||
}
|
}
|
||||||
|
|
||||||
Assert.IsTrue (File.Exists (bar), "#1");
|
Assert.IsTrue (File.Exists (bar), "#1");
|
||||||
File.Move (bar, baz);
|
Assert.DoesNotThrow (() => File.Move (bar, baz), "#5");
|
||||||
Assert.IsFalse (File.Exists (bar), "#2");
|
Assert.IsFalse (File.Exists (bar), "#2");
|
||||||
Assert.IsTrue (File.Exists (baz), "#3");
|
Assert.IsTrue (File.Exists (baz), "#3");
|
||||||
|
|
||||||
@ -939,7 +939,7 @@ namespace MonoTests.System.IO
|
|||||||
Directory.CreateDirectory (dir);
|
Directory.CreateDirectory (dir);
|
||||||
Directory.CreateDirectory (dir2);
|
Directory.CreateDirectory (dir2);
|
||||||
File.Create (dir_foo).Close ();
|
File.Create (dir_foo).Close ();
|
||||||
File.Move (dir_foo, dir2_foo);
|
Assert.DoesNotThrow (() => File.Move (dir_foo, dir2_foo), "#6");
|
||||||
Assert.IsTrue (File.Exists (dir2_foo), "#4");
|
Assert.IsTrue (File.Exists (dir2_foo), "#4");
|
||||||
|
|
||||||
Directory.Delete (dir, true);
|
Directory.Delete (dir, true);
|
||||||
|
@ -1 +1 @@
|
|||||||
3bb5075309cfee79947231190b6c06970814ecbf
|
812e72bb33c83991369be9f9ec7ceb56d725d4ba
|
@ -1 +1 @@
|
|||||||
4eff81e78b9af7cda22830830d3d49092a6b7018
|
abbfbea3a51f4a664ba8db3d9464ad05a3e55baf
|
@ -1 +1 @@
|
|||||||
3b0cda7b19ee016a6f2b3ad97ef9a6ddd8b9bbe5
|
7aadfbf5cf560b7c3b74e842ea934137d259649f
|
Binary file not shown.
@ -1 +1 @@
|
|||||||
167a06dea1a9f639eed2d5ae04afc5c23891d656
|
edd9d4c737bb1d7820ff3adb5eb44303676c0579
|
@ -1 +1 @@
|
|||||||
71b6657d1ec9f6a632e30c9ed789ef7fd6e97b70
|
a4050af4872d879b40435b821550b364b53a0c5e
|
@ -1 +1 @@
|
|||||||
81c98bb54997edda2c51abc2c020a02ef58bcb65
|
78cc979f44705424bfcf8a9065b8f1ea0c06a407
|
@ -1 +1 @@
|
|||||||
02e92c8371781b6e97eef8cd9fff063521233353
|
10a0ef69f7a743c313c308618241d53fbf0867c8
|
@ -1 +1 @@
|
|||||||
3bb5075309cfee79947231190b6c06970814ecbf
|
812e72bb33c83991369be9f9ec7ceb56d725d4ba
|
@ -1 +1 @@
|
|||||||
4eff81e78b9af7cda22830830d3d49092a6b7018
|
abbfbea3a51f4a664ba8db3d9464ad05a3e55baf
|
@ -1 +1 @@
|
|||||||
3b0cda7b19ee016a6f2b3ad97ef9a6ddd8b9bbe5
|
7aadfbf5cf560b7c3b74e842ea934137d259649f
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user