2005-03-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
[mono.git] / mcs / class / corlib / System.IO / MonoIO.cs
index 9477bb21ddb873f914a067fda106021039e2cbaf..5f7994e9ce2f2db07749d495987443b24fdabaed 100644 (file)
@@ -66,6 +66,9 @@ namespace System.IO
                                return new FileNotFoundException (message,
                                                                  path);
 
+                       case MonoIOError.ERROR_TOO_MANY_OPEN_FILES:
+                               return new IOException ("Too many open files");
+                               
                        case MonoIOError.ERROR_PATH_NOT_FOUND:
                                message = String.Format ("Could not find a part of the path \"{0}\"", path);
                                return new DirectoryNotFoundException (message);
@@ -74,6 +77,10 @@ namespace System.IO
                                message = String.Format ("Access to the path \"{0}\" is denied.", path);
                                return new UnauthorizedAccessException (message);
 
+                       case MonoIOError.ERROR_INVALID_HANDLE:
+                               message = String.Format ("Invalid handle to path \"{0}\"", path);
+                               return new IOException (message);
+                               
                        case MonoIOError.ERROR_FILE_EXISTS:
                                message = String.Format ("Could not create file \"{0}\". File already exists.", path);
                                return new IOException (message);
@@ -82,6 +89,18 @@ namespace System.IO
                                message = String.Format ("Path is too long. Path: {0}", path); 
                                return new PathTooLongException (message);
 
+                       case MonoIOError.ERROR_INVALID_PARAMETER:
+                               message = String.Format ("Invalid parameter");
+                               return new IOException (message);
+
+                       case MonoIOError.ERROR_SHARING_VIOLATION:
+                               message = String.Format ("Sharing violation on path {0}", path);
+                               return new IOException (message);
+                               
+                       case MonoIOError.ERROR_LOCK_VIOLATION:
+                               message = String.Format ("Lock violation on path {0}", path);
+                               return new IOException (message);
+                               
                        default:
                                message = String.Format ("Win32 IO returned {0}. Path: {1}", error, path);
                                return new IOException (message);
@@ -305,7 +324,9 @@ namespace System.IO
                        result = SetFileTime (handle, creation_time,
                                              last_access_time,
                                              last_write_time, out error);
-                       Close (handle, out error);
+
+                       MonoIOError ignore_error;
+                       Close (handle, out ignore_error);
                        
                        return result;
                }