From 0946584ddd12919accccefb8708aece107c74b09 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
 =?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Wed, 28 Dec 2011 23:35:42 +0400
Subject: [PATCH 3/4] Give all directories embedded names

---
 src/fs/gnunet-fs-gtk-main_window_file_publish.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/fs/gnunet-fs-gtk-main_window_file_publish.c b/src/fs/gnunet-fs-gtk-main_window_file_publish.c
index 61a1c70..95dbdf2 100644
--- a/src/fs/gnunet-fs-gtk-main_window_file_publish.c
+++ b/src/fs/gnunet-fs-gtk-main_window_file_publish.c
@@ -741,6 +741,7 @@ scan_directory (void *cls, const char *filename)
     return GNUNET_OK;
   if (S_ISDIR (sbuf.st_mode))
   {
+    const char *ss, *short_fn;
     parent = adc->parent;
     mhm = adc->metamap;
     mcm = adc->metacounter;
@@ -760,6 +761,17 @@ scan_directory (void *cls, const char *filename)
     adc->metacounter = mcm;
     adc->parent = parent;
     adc->dir_entry_count = pc + 1;
+
+    short_fn = filename;
+    while (NULL != (ss = strstr (short_fn, DIR_SEPARATOR_STR)) && ss[1] != '\0')
+      short_fn = 1 + ss;
+
+    GNUNET_CONTAINER_meta_data_insert (pd->meta, "<gnunet-gtk>",
+                                       EXTRACTOR_METATYPE_FILENAME,
+                                       EXTRACTOR_METAFORMAT_UTF8,
+                                       "text/plain", short_fn,
+                                       strlen (short_fn) + 1);
+
     if (adc->metamap != NULL)
     {
       GNUNET_CRYPTO_hash (filename, strlen (filename), &hc);
@@ -769,18 +781,8 @@ scan_directory (void *cls, const char *filename)
     }
     else
     {
-      const char *ss, *short_fn;
-
       GNUNET_assert (mcm == NULL);
       /* we're top-level */
-      short_fn = filename;
-      while (NULL != (ss = strstr (short_fn, DIR_SEPARATOR_STR)))
-        short_fn = 1 + ss;
-      GNUNET_CONTAINER_meta_data_insert (pd->meta, "<gnunet-gtk>",
-                                         EXTRACTOR_METATYPE_FILENAME,
-                                         EXTRACTOR_METAFORMAT_UTF8,
-                                         "text/plain", filename,
-                                         strlen (filename) + 1);
       add_entry_to_ts (adc->ts, &pd->iter, filename, &adc->bo, adc->do_index,
                        NULL, pd->meta);
     }
-- 
1.7.4

