dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/IO Directory.cs,1.14,


From: Gopal.V <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/IO Directory.cs,1.14,1.15
Date: Thu, 03 Apr 2003 11:15:54 -0500

Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System/IO
In directory subversions:/tmp/cvs-serv9148/runtime/System/IO

Modified Files:
        Directory.cs 
Log Message:
Fix to bug #3089 -- recursive Directory.CreateDirectory()


Index: Directory.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/IO/Directory.cs,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** Directory.cs        1 Apr 2003 02:48:33 -0000       1.14
--- Directory.cs        3 Apr 2003 16:15:51 -0000       1.15
***************
*** 42,52 ****
  
  #if !ECMA_COMPAT      
                public static DirectoryInfo CreateDirectory(String path)
                {
                        Exception e=ValidatePath(path, "path");
                        if(e != null) throw e;
!               
!                       Errno err = DirMethods.CreateDirectory(path);
!                       e=GetErrnoExceptions(err,path);
                        if(e != null) throw e;
  
--- 42,72 ----
  
  #if !ECMA_COMPAT      
+               
+               public static Exception InternalCreateDirectory(String path)
+               {
+                       if(!File.Exists(Path.GetDirectoryName(path)))
+                       {
+                               
InternalCreateDirectory(Path.GetDirectoryName(path));
+                       }
+               
+                       Errno err = DirMethods.CreateDirectory(path);
+ 
+                       /* TODO: protect against stuff like 
+                       CreateDirectory("a.out.exe/mydir"); which currently 
throw
+                       a SecurityException without any clue of the error */
+ 
+                       if(err != Errno.Success)
+                       {
+                               return GetErrnoExceptions(err,path);
+                       }
+                       return null;
+               }
+ 
                public static DirectoryInfo CreateDirectory(String path)
                {
                        Exception e=ValidatePath(path, "path");
                        if(e != null) throw e;
!                       
!                       e = InternalCreateDirectory(path);
                        if(e != null) throw e;
  
***************
*** 161,164 ****
--- 181,186 ----
                                case Errno.ENAMETOOLONG:
                                        return new PathTooLongException();
+                               case Errno.EPERM:
+                                       return new 
SecurityException(_("IO_PathnameSecurity"));
                        }
                        return null;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]