2
0
Эх сурвалжийг харах

* UnixDriveInfo.cs: Properties should generate an InvalidOperationException,
not an IOException. Users can use IsReady to avoid exception generation.
* UnixIOException.cs: Create a custom message that embeds the error name
within the text, e.g. "Permission denied [EACCES]."
* UnixSymbolicLinkInfo.cs: This really should create the file FullPath, not
OriginalPath. Created files shouldn't ever be relative to the current
working directory, as this can change at any time.

svn path=/trunk/mcs/; revision=55873

Jonathan Pryor 20 жил өмнө
parent
commit
87a30dfc12

+ 10 - 0
mcs/class/Mono.Posix/Mono.Unix/ChangeLog

@@ -1,3 +1,13 @@
+2006-01-20  Jonathan Pryor  <[email protected]>
+
+	* UnixDriveInfo.cs: Properties should generate an InvalidOperationException,
+	  not an IOException.  Users can use IsReady to avoid exception generation.
+	* UnixIOException.cs: Create a custom message that embeds the error name 
+	  within the text, e.g. "Permission denied [EACCES]."
+	* UnixSymbolicLinkInfo.cs: This really should create the file FullPath, not
+	  OriginalPath.  Created files shouldn't ever be relative to the current
+	  working directory, as this can change at any time.
+
 2006-01-15  Jonathan Pryor  <[email protected]>
 
 	* UnixUserInfo.cs: The UnixUserInfo(Native.Passwd) constructor and 

+ 3 - 2
mcs/class/Mono.Posix/Mono.Unix/UnixDriveInfo.cs

@@ -158,8 +158,9 @@ namespace Mono.Unix {
 			int r = Native.Syscall.statvfs (fstab.fs_file, out stat);
 			if (r == -1 && throwException) {
 				Native.Errno e = Native.Syscall.GetLastError ();
-				throw new IOException (UnixMarshal.GetErrorDescription (e),
-					UnixMarshal.CreateExceptionForError (e));
+				throw new InvalidOperationException (
+						UnixMarshal.GetErrorDescription (e),
+						new UnixIOException (e));
 			}
 			else if (r == -1)
 				return false;

+ 11 - 4
mcs/class/Mono.Posix/Mono.Unix/UnixIOException.cs

@@ -44,25 +44,25 @@ namespace Mono.Unix {
 		{}
 		
 		public UnixIOException (int errno)
-			: base (UnixMarshal.GetErrorDescription (Native.NativeConvert.ToErrno (errno)))
+			: base (GetMessage (Native.NativeConvert.ToErrno (errno)))
 		{
 			this.errno = errno;
 		}
 		
 		public UnixIOException (int errno, Exception inner)
-			: base (UnixMarshal.GetErrorDescription (Native.NativeConvert.ToErrno (errno)), inner)
+			: base (GetMessage (Native.NativeConvert.ToErrno (errno)), inner)
 		{
 			this.errno = errno;
 		}
 
 		public UnixIOException (Native.Errno errno)
-			: base (UnixMarshal.GetErrorDescription (errno))
+			: base (GetMessage (errno))
 		{
 			this.errno = Native.NativeConvert.FromErrno (errno);
 		}
 
 		public UnixIOException (Native.Errno errno, Exception inner)
-			: base (UnixMarshal.GetErrorDescription (errno), inner)
+			: base (GetMessage (errno), inner)
 		{
 			this.errno = Native.NativeConvert.FromErrno (errno);
 		}
@@ -91,6 +91,13 @@ namespace Mono.Unix {
 		public Native.Errno ErrorCode {
 			get {return Native.NativeConvert.ToErrno (errno);}
 		}
+
+		private static string GetMessage (Native.Errno errno)
+		{
+			return string.Format ("{0} [{1}].",
+					UnixMarshal.GetErrorDescription (errno),
+					errno);
+		}
 	}
 }
 

+ 1 - 1
mcs/class/Mono.Posix/Mono.Unix/UnixSymbolicLinkInfo.cs

@@ -72,7 +72,7 @@ namespace Mono.Unix {
 
 		public void CreateSymbolicLinkTo (string path)
 		{
-			int r = Native.Syscall.symlink (path, OriginalPath);
+			int r = Native.Syscall.symlink (path, FullName);
 			UnixMarshal.ThrowExceptionForLastErrorIf (r);
 		}