Workaround FUSE missing the generally broken Linux kernel charset support.
[captive.git] / src / client / fuse / op_readdir.c
index 16f920a..35d14a7 100644 (file)
@@ -29,6 +29,7 @@
 #include "main.h"
 #include "gnomevfsresult.h"
 #include "capfuse_captive_file_info_object.h"
+#include "utf8.h"
 
 
 /* int (*fuse_fill_dir_t)(void *buf,const char *name,const struct stat *stbuf,off_t off); */
@@ -51,17 +52,20 @@ CaptiveFileInfoObject *captive_file_info_object;
                        &captive_file_info_object))) {  /* captive_file_info_object */
 struct stat stat;
 int errint;
+char *captive_file_info_object_name;
 
                errint=capfuse_captive_file_info_object_to_stat(&stat,captive_file_info_object);
                if (errint) {
                        g_object_unref(captive_file_info_object);
                        return errint;
                        }
+               captive_file_info_object_name=capfuse_filename_from_utf8_malloc_errorchecking(captive_file_info_object->p.name);
                errint=(*fill_dir)(
                                buf,    /* buf; opaque */
-                               captive_file_info_object->p.name,       /* name */
+                               (captive_file_info_object_name ? captive_file_info_object_name : captive_file_info_object->p.name),     /* name */
                                &stat,  /* stbuf */
                                0);     /* off; operation mode 1 - <fuse.h>/(*readdir) */
+               g_free(captive_file_info_object_name);  /* may be NULL */
                /* WARNING: (*fill_dir) needs: *captive_file_info_object->p.name */
                g_object_unref(captive_file_info_object);
                if (errint) {