[seed] [libseed] Use canonicalize_file_name instead of realpath



commit 2b6406f682002c136cb62176214859699768f2df
Author: Tim Horton <hortont svn gnome org>
Date:   Thu Jul 16 16:32:32 2009 -0400

    [libseed] Use canonicalize_file_name instead of realpath
    
    Apparently MAX_PATH is broken on many systems, and realpath is just a bad idea;
    this trades one problem for another, because now we depend on a glibc extension

 libseed/seed-importer.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/libseed/seed-importer.c b/libseed/seed-importer.c
index bd64a76..585f890 100644
--- a/libseed/seed-importer.c
+++ b/libseed/seed-importer.c
@@ -1,3 +1,5 @@
+// TODO: Don't use GNU libc extension canonicalize_file_name, don't use realpath?
+#define _GNU_SOURCE
 
 #include <gio/gio.h>
 #include <string.h>
@@ -596,7 +598,7 @@ seed_importer_handle_file (JSContextRef ctx,
   JSObjectRef global, c_global;
   JSStringRef file_contents, file_name;
   gchar *contents, *walk, *file_path, *canonical, *absolute_path;
-  gchar normalized_path[PATH_MAX];
+  gchar *normalized_path;
 
   file_path = g_build_filename(dir, file, NULL);
   canonical = seed_importer_canonicalize_path (file_path);
@@ -650,7 +652,7 @@ seed_importer_handle_file (JSContextRef ctx,
 				       g_path_get_dirname(file_path), NULL);
     }
 
-  realpath(absolute_path, normalized_path);
+  normalized_path = canonicalize_file_name(absolute_path);
 
   js_file_dirname = seed_value_from_string(ctx, normalized_path, NULL);
   



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