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,67 +29,11 @@ namespace System.IO
|
||||
}
|
||||
}
|
||||
|
||||
public static void ReplaceFile(string sourceFullPath, string destFullPath, string destBackupFullPath, bool ignoreMetadataErrors)
|
||||
private static void LinkOrCopyFile (string sourceFullPath, string destFullPath)
|
||||
{
|
||||
if (destBackupFullPath != null)
|
||||
{
|
||||
// We're backing up the destination file to the backup file, so we need to first delete the backup
|
||||
// file, if it exists. If deletion fails for a reason other than the file not existing, fail.
|
||||
if (Interop.Sys.Unlink(destBackupFullPath) != 0)
|
||||
{
|
||||
Interop.ErrorInfo errno = Interop.Sys.GetLastErrorInfo();
|
||||
if (errno.Error != Interop.Error.ENOENT)
|
||||
{
|
||||
throw Interop.GetExceptionForIoErrno(errno, destBackupFullPath);
|
||||
}
|
||||
}
|
||||
|
||||
// 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.
|
||||
Interop.CheckIo(Interop.Sys.Link(destFullPath, destBackupFullPath), destFullPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
// There is no backup file. Just make sure the destination file exists, throwing if it doesn't.
|
||||
Interop.Sys.FileStatus ignored;
|
||||
if (Interop.Sys.Stat(destFullPath, out ignored) != 0)
|
||||
{
|
||||
Interop.ErrorInfo errno = Interop.Sys.GetLastErrorInfo();
|
||||
if (errno.Error == Interop.Error.ENOENT)
|
||||
{
|
||||
throw Interop.GetExceptionForIoErrno(errno, destBackupFullPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Finally, rename the source to the destination, overwriting the destination.
|
||||
Interop.CheckIo(Interop.Sys.Rename(sourceFullPath, destFullPath));
|
||||
}
|
||||
|
||||
public static void MoveFile(string sourceFullPath, string destFullPath)
|
||||
{
|
||||
// The desired behavior for Move(source, dest) is to not overwrite the destination file
|
||||
// if it exists. Since rename(source, dest) will replace the file at 'dest' if it exists,
|
||||
// link/unlink are used instead. However, if the source path and the dest path refer to
|
||||
// the same file, then do a rename rather than a link and an unlink. This is important
|
||||
// for case-insensitive file systems (e.g. renaming a file in a way that just changes casing),
|
||||
// so that we support changing the casing in the naming of the file. If this fails in any
|
||||
// way (e.g. source file doesn't exist, dest file doesn't exist, rename fails, etc.), we
|
||||
// just fall back to trying the link/unlink approach and generating any exceptional messages
|
||||
// from there as necessary.
|
||||
Interop.Sys.FileStatus sourceStat, destStat;
|
||||
if (Interop.Sys.LStat(sourceFullPath, out sourceStat) == 0 && // source file exists
|
||||
Interop.Sys.LStat(destFullPath, out destStat) == 0 && // dest file exists
|
||||
sourceStat.Dev == destStat.Dev && // source and dest are on the same device
|
||||
sourceStat.Ino == destStat.Ino && // and source and dest are the same file on that device
|
||||
Interop.Sys.Rename(sourceFullPath, destFullPath) == 0) // try the rename
|
||||
{
|
||||
// Renamed successfully.
|
||||
if (Interop.Sys.Link(sourceFullPath, destFullPath) >= 0)
|
||||
return;
|
||||
}
|
||||
|
||||
if (Interop.Sys.Link(sourceFullPath, destFullPath) < 0)
|
||||
{
|
||||
// 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
|
||||
@ -99,6 +43,7 @@ namespace System.IO
|
||||
// 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
|
||||
@ -140,6 +85,68 @@ namespace System.IO
|
||||
throw Interop.GetExceptionForIoErrno(errorInfo, path, isDirectory);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void ReplaceFile(string sourceFullPath, string destFullPath, string destBackupFullPath, bool ignoreMetadataErrors)
|
||||
{
|
||||
if (destBackupFullPath != null)
|
||||
{
|
||||
// We're backing up the destination file to the backup file, so we need to first delete the backup
|
||||
// file, if it exists. If deletion fails for a reason other than the file not existing, fail.
|
||||
if (Interop.Sys.Unlink(destBackupFullPath) != 0)
|
||||
{
|
||||
Interop.ErrorInfo errno = Interop.Sys.GetLastErrorInfo();
|
||||
if (errno.Error != Interop.Error.ENOENT)
|
||||
{
|
||||
throw Interop.GetExceptionForIoErrno(errno, destBackupFullPath);
|
||||
}
|
||||
}
|
||||
|
||||
// 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.
|
||||
LinkOrCopyFile(destFullPath, destBackupFullPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
// There is no backup file. Just make sure the destination file exists, throwing if it doesn't.
|
||||
Interop.Sys.FileStatus ignored;
|
||||
if (Interop.Sys.Stat(destFullPath, out ignored) != 0)
|
||||
{
|
||||
Interop.ErrorInfo errno = Interop.Sys.GetLastErrorInfo();
|
||||
if (errno.Error == Interop.Error.ENOENT)
|
||||
{
|
||||
throw Interop.GetExceptionForIoErrno(errno, destBackupFullPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Finally, rename the source to the destination, overwriting the destination.
|
||||
Interop.CheckIo(Interop.Sys.Rename(sourceFullPath, destFullPath));
|
||||
}
|
||||
|
||||
public static void MoveFile(string sourceFullPath, string destFullPath)
|
||||
{
|
||||
// The desired behavior for Move(source, dest) is to not overwrite the destination file
|
||||
// if it exists. Since rename(source, dest) will replace the file at 'dest' if it exists,
|
||||
// link/unlink are used instead. However, if the source path and the dest path refer to
|
||||
// the same file, then do a rename rather than a link and an unlink. This is important
|
||||
// for case-insensitive file systems (e.g. renaming a file in a way that just changes casing),
|
||||
// so that we support changing the casing in the naming of the file. If this fails in any
|
||||
// way (e.g. source file doesn't exist, dest file doesn't exist, rename fails, etc.), we
|
||||
// just fall back to trying the link/unlink approach and generating any exceptional messages
|
||||
// from there as necessary.
|
||||
Interop.Sys.FileStatus sourceStat, destStat;
|
||||
if (Interop.Sys.LStat(sourceFullPath, out sourceStat) == 0 && // source file exists
|
||||
Interop.Sys.LStat(destFullPath, out destStat) == 0 && // dest file exists
|
||||
sourceStat.Dev == destStat.Dev && // source and dest are on the same device
|
||||
sourceStat.Ino == destStat.Ino && // and source and dest are the same file on that device
|
||||
Interop.Sys.Rename(sourceFullPath, destFullPath) == 0) // try the rename
|
||||
{
|
||||
// Renamed successfully.
|
||||
return;
|
||||
}
|
||||
|
||||
LinkOrCopyFile(sourceFullPath, destFullPath);
|
||||
DeleteFile(sourceFullPath);
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ static partial class Consts
|
||||
// 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 MonoProduct = "Mono Common Language Infrastructure";
|
||||
public const string MonoCopyright = "(c) Various Mono authors";
|
||||
|
@ -5,7 +5,6 @@
|
||||
../../../mono/mini/basic-float.cs
|
||||
../../../mono/mini/basic-long.cs
|
||||
../../../mono/mini/basic-math.cs
|
||||
../../../mono/mini/basic-simd.cs
|
||||
../../../mono/mini/basic-vectors.cs
|
||||
../../../mono/mini/basic.cs
|
||||
../../../mono/mini/bench.cs
|
||||
|
@ -9,8 +9,12 @@ include ../../build/rules.make
|
||||
LIBRARY = Mono.Runtime.Tests.dll
|
||||
NO_BUILD = 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
|
||||
|
||||
ifneq ($(PROFILE),monodroid)
|
||||
LIB_REFS += Mono.Simd
|
||||
endif
|
||||
|
||||
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);
|
||||
if (!string.IsNullOrEmpty (TreeView.SelectedImageKey))
|
||||
return TreeView.ImageList.Images.IndexOfKey (TreeView.SelectedImageKey);
|
||||
if (TreeView.SelectedImageIndex >= 0)
|
||||
if (selected_image_index == -1 && TreeView.SelectedImageIndex >= 0)
|
||||
return TreeView.SelectedImageIndex;
|
||||
} else {
|
||||
if (image_index >= 0)
|
||||
@ -1080,13 +1080,10 @@ namespace System.Windows.Forms
|
||||
return TreeView.ImageList.Images.IndexOfKey (image_key);
|
||||
if (!string.IsNullOrEmpty (TreeView.ImageKey))
|
||||
return TreeView.ImageList.Images.IndexOfKey (TreeView.ImageKey);
|
||||
if (TreeView.ImageIndex >= 0)
|
||||
if (image_index == -1 && TreeView.ImageIndex >= 0)
|
||||
return TreeView.ImageIndex;
|
||||
}
|
||||
|
||||
if (TreeView.ImageList.Images.Count > 0)
|
||||
return 0;
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -923,7 +923,7 @@ namespace MonoTests.System.IO
|
||||
}
|
||||
|
||||
Assert.IsTrue (File.Exists (bar), "#1");
|
||||
File.Move (bar, baz);
|
||||
Assert.DoesNotThrow (() => File.Move (bar, baz), "#5");
|
||||
Assert.IsFalse (File.Exists (bar), "#2");
|
||||
Assert.IsTrue (File.Exists (baz), "#3");
|
||||
|
||||
@ -939,7 +939,7 @@ namespace MonoTests.System.IO
|
||||
Directory.CreateDirectory (dir);
|
||||
Directory.CreateDirectory (dir2);
|
||||
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");
|
||||
|
||||
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