Imported Upstream version 4.6.0.125

Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-08-03 10:59:49 +00:00
parent a569aebcfd
commit e79aa3c0ed
17047 changed files with 3137615 additions and 392334 deletions

View File

@@ -113,6 +113,21 @@ namespace System.IO
}
}
internal static String InternalCopy (String sourceFileName, String destFileName, bool overwrite, bool checkHost)
{
String fullSourceFileName = Path.GetFullPathInternal(sourceFileName);
String fullDestFileName = Path.GetFullPathInternal(destFileName);
MonoIOError error;
if (!MonoIO.CopyFile (fullSourceFileName, fullDestFileName, overwrite, out error)) {
string p = Locale.GetText ("{0}\" or \"{1}", sourceFileName, destFileName);
throw MonoIO.GetException (p, error);
}
return fullDestFileName;
}
public static FileStream Create (string path)
{
return Create (path, 8192);
@@ -124,14 +139,15 @@ namespace System.IO
FileShare.None, bufferSize);
}
#if !NET_2_1
[MonoLimitation ("FileOptions are ignored")]
public static FileStream Create (string path, int bufferSize,
FileOptions options)
{
return Create (path, bufferSize, options, null);
return new FileStream (path, FileMode.Create, FileAccess.ReadWrite,
FileShare.None, bufferSize, options);
}
#if !NET_2_1
[MonoLimitation ("FileOptions and FileSecurity are ignored")]
public static FileStream Create (string path, int bufferSize,
FileOptions options,
@@ -406,6 +422,12 @@ namespace System.IO
"Destination and backup arguments are the same file."));
}
var attrs = GetAttributes (fullDest);
// TODO: Should be done in wapi, win32 api handles this already
if ((attrs & FileAttributes.ReadOnly) != 0)
throw MonoIO.GetException (MonoIOError.ERROR_ACCESS_DENIED);
if (!MonoIO.ReplaceFile (fullSource, fullDest, fullBackup,
ignoreMetadataErrors, out error)) {
throw MonoIO.GetException (error);
@@ -688,5 +710,22 @@ namespace System.IO
w.WriteLine (line);
}
}
internal static int FillAttributeInfo (String path, ref MonoIOStat data, bool tryagain, bool returnErrorOnNotFound)
{
if (tryagain)
throw new NotImplementedException ();
MonoIOError error;
MonoIO.GetFileStat (path, out data, out error);
if (!returnErrorOnNotFound && (error == MonoIOError.ERROR_FILE_NOT_FOUND || error == MonoIOError.ERROR_PATH_NOT_FOUND || error == MonoIOError.ERROR_NOT_READY)) {
data = default (MonoIOStat);
data.fileAttributes = (FileAttributes) (-1);
return 0;
}
return (int) error;
}
}
}