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.7,1.


From: Gopal.V <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/IO Directory.cs,1.7,1.8
Date: Sun, 15 Dec 2002 11:05:11 -0500

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

Modified Files:
        Directory.cs 
Log Message:
Patch #829 from Aditya P Bansod . Support recursive directory deletion


Index: Directory.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/IO/Directory.cs,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** Directory.cs        1 Dec 2002 09:56:20 -0000       1.7
--- Directory.cs        15 Dec 2002 16:05:09 -0000      1.8
***************
*** 46,50 ****
                }
                
-               [TODO]
                public static void Delete(string path, bool recursive)
                {
--- 46,49 ----
***************
*** 53,61 ****
                                throw new ArgumentNullException();
                        }
!                       if(path.Length==0 || (path.Trim()).Length==0 || 
path.IndexOfAny(pathinfo.invalidPathChars)!= -1)
                        {
                                throw new ArgumentException();
                        }
  
                        Errno errno = DirMethods.Delete(path);
  
--- 52,64 ----
                                throw new ArgumentNullException();
                        }
!                       if(path.Length==0 || (path.Trim()).Length==0 || 
!                                                       
path.IndexOfAny(Path.InvalidPathChars)!= -1)
                        {
                                throw new ArgumentException();
                        }
  
+                       // remove any trailing directory sep characters
+                       if(path.GetChar(path.Length-1) == 
Path.DirectorySeparatorChar)
+                               path = path.Substring(0, path.Length - 1);
                        Errno errno = DirMethods.Delete(path);
  
***************
*** 72,76 ****
                                        else
                                        {
!                                               // TODO
                                        }
                                        break;
--- 75,93 ----
                                        else
                                        {
!                                               foreach(string subFile in 
GetFiles(path))
!                                               {
!                                                       File.Delete(path + 
!                                                       
Path.DirectorySeparatorChar.ToString() + subFile);
!                                               }
! 
!                                               foreach(string subDir in 
GetDirectories(path))
!                                               {
!                                                       if(subDir == "." || 
subDir == "..")
!                                                               continue;
!                                                       Delete(path 
+Path.DirectorySeparatorChar.ToString() 
!                                                                       + 
subDir, recursive);
!                                               }
!                                               // now delete this dir
!                                               Delete(path);
                                        }
                                        break;
***************
*** 85,88 ****
--- 102,108 ----
                                case Errno.ENAMETOOLONG:                        
                
                                        throw new PathTooLongException();
+ 
+                               case Errno.Success:
+                                       return;
                                // TODO
                                // Throw some appropriate exception.
***************
*** 94,98 ****
                public static bool Exists(string path)
                {
!                       if(path.Length==0 || (path.Trim()).Length==0 || 
path.IndexOfAny(pathinfo.invalidPathChars)!= -1)
                        {       
                                throw new ArgumentException();
--- 114,119 ----
                public static bool Exists(string path)
                {
!                       if(path.Length==0 || (path.Trim()).Length==0 || 
!                                               
path.IndexOfAny(pathinfo.invalidPathChars)!= -1)
                        {       
                                throw new ArgumentException();
***************
*** 129,134 ****
                private static void VerifyDirectoryAccess(String path)
                {
!                       if(path.Length==0 || (path.Trim()).Length==0)
!               //FIXME:                        ||      
path.IndexOfAny(pathinfo.invalidPathChars)!= -1)
                        {       
                                throw new ArgumentException();
--- 150,154 ----
                private static void VerifyDirectoryAccess(String path)
                {
!                       if(path.Length==0 || (path.Trim()).Length==0 || 
(path.IndexOfAny(pathinfo.invalidPathChars)!= -1))
                        {       
                                throw new ArgumentException();




reply via email to

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