[gegl] load: resolve symlinks



commit 6eb44c296aa76498eae71fff3fc1771088ea4c73
Author: Øyvind Kolås <pippin gimp org>
Date:   Thu Jan 28 15:48:13 2016 +0100

    load: resolve symlinks

 operations/common/load.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/operations/common/load.c b/operations/common/load.c
index ecc5627..9a8935e 100644
--- a/operations/common/load.c
+++ b/operations/common/load.c
@@ -93,10 +93,13 @@ do_setup (GeglOperation *operation, const gchar *new_path, const gchar *new_uri)
     {
       const gchar *extension = strrchr (new_path, '.');
       const gchar *handler   = NULL;
+      char   resolved_path[PATH_MAX];
 
-      if (!g_file_test (new_path, G_FILE_TEST_EXISTS))
+      realpath (new_path, resolved_path);
+
+      if (!g_file_test (resolved_path, G_FILE_TEST_EXISTS))
         {
-          gchar *name = g_filename_display_name (new_path);
+          gchar *name = g_filename_display_name (resolved_path);
           gchar *tmp  = g_strdup_printf ("File '%s' does not exist", name);
           g_free (name);
 
@@ -116,7 +119,7 @@ do_setup (GeglOperation *operation, const gchar *new_path, const gchar *new_uri)
                          "operation", handler,
                          NULL);
           gegl_node_set (self->load,
-                         "path", new_path,
+                         "path", resolved_path,
                          NULL);
         }
     }


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