]> Pileus Git - ~andy/gtk/commitdiff
Test that path is actually a directory and throw error if not. Fixed bug
authorJ. Ali Harlow <ali@juiblex.co.uk>
Wed, 24 Mar 2004 16:50:56 +0000 (16:50 +0000)
committerJ. Ali Harlow <j_ali@src.gnome.org>
Wed, 24 Mar 2004 16:50:56 +0000 (16:50 +0000)
2004-03-24  J. Ali Harlow  <ali@juiblex.co.uk>

        * gtk/gtkfilesystemwin32.c
(gtk_file_system_win32_get_folder): Test that path is actually
a directory and throw error if not. Fixed bug #137950

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkfilesystemwin32.c

index 9ec56fe23480dfaa72ed38a781178a4f53eab180..875718d84b5bdbaec15b242030a167e147bf46ac 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-03-24  J. Ali Harlow  <ali@juiblex.co.uk>
+
+       * gtk/gtkfilesystemwin32.c
+       (gtk_file_system_win32_get_folder): Test that path is actually
+       a directory and throw error if not. Fixed bug #137950
+
 2004-03-22  J. Ali Harlow  <ali@juiblex.co.uk>
 
        * gtk/gtkfilesystemwin32.c
index 9ec56fe23480dfaa72ed38a781178a4f53eab180..875718d84b5bdbaec15b242030a167e147bf46ac 100644 (file)
@@ -1,3 +1,9 @@
+2004-03-24  J. Ali Harlow  <ali@juiblex.co.uk>
+
+       * gtk/gtkfilesystemwin32.c
+       (gtk_file_system_win32_get_folder): Test that path is actually
+       a directory and throw error if not. Fixed bug #137950
+
 2004-03-22  J. Ali Harlow  <ali@juiblex.co.uk>
 
        * gtk/gtkfilesystemwin32.c
index 9ec56fe23480dfaa72ed38a781178a4f53eab180..875718d84b5bdbaec15b242030a167e147bf46ac 100644 (file)
@@ -1,3 +1,9 @@
+2004-03-24  J. Ali Harlow  <ali@juiblex.co.uk>
+
+       * gtk/gtkfilesystemwin32.c
+       (gtk_file_system_win32_get_folder): Test that path is actually
+       a directory and throw error if not. Fixed bug #137950
+
 2004-03-22  J. Ali Harlow  <ali@juiblex.co.uk>
 
        * gtk/gtkfilesystemwin32.c
index 9ec56fe23480dfaa72ed38a781178a4f53eab180..875718d84b5bdbaec15b242030a167e147bf46ac 100644 (file)
@@ -1,3 +1,9 @@
+2004-03-24  J. Ali Harlow  <ali@juiblex.co.uk>
+
+       * gtk/gtkfilesystemwin32.c
+       (gtk_file_system_win32_get_folder): Test that path is actually
+       a directory and throw error if not. Fixed bug #137950
+
 2004-03-22  J. Ali Harlow  <ali@juiblex.co.uk>
 
        * gtk/gtkfilesystemwin32.c
index 9ec56fe23480dfaa72ed38a781178a4f53eab180..875718d84b5bdbaec15b242030a167e147bf46ac 100644 (file)
@@ -1,3 +1,9 @@
+2004-03-24  J. Ali Harlow  <ali@juiblex.co.uk>
+
+       * gtk/gtkfilesystemwin32.c
+       (gtk_file_system_win32_get_folder): Test that path is actually
+       a directory and throw error if not. Fixed bug #137950
+
 2004-03-22  J. Ali Harlow  <ali@juiblex.co.uk>
 
        * gtk/gtkfilesystemwin32.c
index c629071a87e61977cd83e3b0c9ffd926b41db278..6064a868099513d9465a98690c9d42a6cbe8d8eb 100644 (file)
@@ -345,6 +345,34 @@ gtk_file_system_win32_get_folder (GtkFileSystem    *file_system,
   filename = filename_from_path (path);
   g_return_val_if_fail (filename != NULL, NULL);
 
+  if (!g_file_test (filename, G_FILE_TEST_IS_DIR))
+    {
+      int save_errno = errno;
+      gchar *filename_utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
+
+      /* If g_file_test() returned FALSE but not due to an error, it means
+       * that the filename is not a directory.
+       */
+      if (save_errno == 0)
+       /* ENOTDIR */
+       g_set_error (error,
+                    GTK_FILE_SYSTEM_ERROR,
+                    GTK_FILE_SYSTEM_ERROR_NOT_FOLDER,
+                    _("%s: %s"),
+                    filename_utf8 ? filename_utf8 : "???",
+                    g_strerror (ENOTDIR));
+      else
+       g_set_error (error,
+                    GTK_FILE_SYSTEM_ERROR,
+                    GTK_FILE_SYSTEM_ERROR_NONEXISTENT,
+                    _("error getting information for '%s': %s"),
+                    filename_utf8 ? filename_utf8 : "???",
+                    g_strerror (save_errno));
+
+      g_free (filename_utf8);
+      return NULL;
+    }
+
   folder_win32 = g_object_new (GTK_TYPE_FILE_FOLDER_WIN32, NULL);
   folder_win32->filename = filename;
   folder_win32->types = types;