[libgsystem] shutil: Allow gs_shutil_rm_rf() to delete files too



commit bfae179c1f6aa15b3a0858b6b7ca6f4b5c4f8278
Author: Colin Walters <walters verbum org>
Date:   Mon Jan 7 05:25:53 2013 -0500

    shutil: Allow gs_shutil_rm_rf() to delete files too
    
    It was documented to do so.

 gsystem-shutil.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/gsystem-shutil.c b/gsystem-shutil.c
index 428f851..380acc4 100644
--- a/gsystem-shutil.c
+++ b/gsystem-shutil.c
@@ -194,6 +194,13 @@ gs_shutil_rm_rf (GFile        *path,
           g_clear_error (&temp_error);
           ret = TRUE;
         }
+      else if (g_error_matches (temp_error, G_IO_ERROR, G_IO_ERROR_NOT_DIRECTORY))
+        {
+          g_clear_error (&temp_error);
+          if (!gs_file_unlink (path, cancellable, error))
+            goto out;
+          ret = TRUE;
+        }
       else
         g_propagate_error (error, temp_error);
 



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