X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2Fcorlib%2FSystem.IO%2FMonoIO.cs;h=a1f4ed5deaab05904407d248624ba761249a13a9;hb=a4039fa632aedad177c3d90a38396469bfee3295;hp=f5ccf450eaf02e1f3fe6fd77646409a0f47458c4;hpb=5bbfa8860b090e465a3aa45edeb9c94481ef1a22;p=mono.git diff --git a/mcs/class/corlib/System.IO/MonoIO.cs b/mcs/class/corlib/System.IO/MonoIO.cs index f5ccf450eaf..a1f4ed5deaa 100644 --- a/mcs/class/corlib/System.IO/MonoIO.cs +++ b/mcs/class/corlib/System.IO/MonoIO.cs @@ -47,7 +47,24 @@ namespace System.IO // error methods public static Exception GetException (MonoIOError error) { - return GetException (String.Empty, error); + /* This overload is currently only called from + * File.MoveFile(), Directory.Move() and + * Directory.GetCurrentDirectory() - + * everywhere else supplies a path to format + * with the error text. + */ + switch(error) { + case MonoIOError.ERROR_ACCESS_DENIED: + return new UnauthorizedAccessException ("Access to the path is denied."); + default: + /* Add more mappings here if other + * errors trigger the named but empty + * path bug (see bug 82141.) For + * everything else, fall through to + * the other overload + */ + return GetException (String.Empty, error); + } } public static Exception GetException (string path, @@ -117,6 +134,10 @@ namespace System.IO case MonoIOError.ERROR_ENCRYPTION_FAILED: return new IOException ("Encryption failed", unchecked((int)0x80070000) | (int)error); + + case MonoIOError.ERROR_CANNOT_MAKE: + message = String.Format ("Path {0} is a directory", path); + return new IOException (message, unchecked((int)0x80070000) | (int)error); default: message = String.Format ("Win32 IO returned {0}. Path: {1}", error, path); @@ -133,7 +154,7 @@ namespace System.IO public extern static bool RemoveDirectory (string path, out MonoIOError error); [MethodImplAttribute (MethodImplOptions.InternalCall)] - public extern static string [] GetFileSystemEntries (string path, string pattern, int attrs, int mask, out MonoIOError error); + public extern static string [] GetFileSystemEntries (string path, string path_with_pattern, int attrs, int mask, out MonoIOError error); [MethodImplAttribute (MethodImplOptions.InternalCall)] public extern static string GetCurrentDirectory (out MonoIOError error); @@ -156,6 +177,13 @@ namespace System.IO public extern static bool DeleteFile (string path, out MonoIOError error); + [MethodImplAttribute (MethodImplOptions.InternalCall)] + public extern static bool ReplaceFile (string sourceFileName, + string destinationFileName, + string destinationBackupFileName, + bool ignoreMetadataErrors, + out MonoIOError error); + [MethodImplAttribute (MethodImplOptions.InternalCall)] public extern static FileAttributes GetFileAttributes (string path, out MonoIOError error); @@ -208,6 +236,20 @@ namespace System.IO return true; } + public static bool ExistsSymlink (string path, + out MonoIOError error) + { + FileAttributes attrs = GetFileAttributes (path, + out error); + if (attrs == InvalidFileAttributes) + return false; + + if ((attrs & FileAttributes.ReparsePoint) == 0) + return false; + + return true; + } + [MethodImplAttribute (MethodImplOptions.InternalCall)] public extern static bool GetFileStat (string path, out MonoIOStat stat,