diff options
Diffstat (limited to 'src/fs/fs_file_information.c')
-rw-r--r-- | src/fs/fs_file_information.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/src/fs/fs_file_information.c b/src/fs/fs_file_information.c index 88d0ca386..e0504be71 100644 --- a/src/fs/fs_file_information.c +++ b/src/fs/fs_file_information.c | |||
@@ -204,6 +204,8 @@ GNUNET_FS_file_information_create_from_file (void *client_info, | |||
204 | struct FileInfo *fi; | 204 | struct FileInfo *fi; |
205 | struct stat sbuf; | 205 | struct stat sbuf; |
206 | struct GNUNET_FS_FileInformation *ret; | 206 | struct GNUNET_FS_FileInformation *ret; |
207 | const char *fn; | ||
208 | const char *ss; | ||
207 | 209 | ||
208 | if (0 != STAT (filename, &sbuf)) | 210 | if (0 != STAT (filename, &sbuf)) |
209 | { | 211 | { |
@@ -230,6 +232,17 @@ GNUNET_FS_file_information_create_from_file (void *client_info, | |||
230 | priority, | 232 | priority, |
231 | expirationTime); | 233 | expirationTime); |
232 | ret->data.file.filename = GNUNET_strdup (filename); | 234 | ret->data.file.filename = GNUNET_strdup (filename); |
235 | fn = filename; | ||
236 | while (NULL != (ss = strstr (fn, | ||
237 | DIR_SEPARATOR_STR))) | ||
238 | fn = ss + 1; | ||
239 | GNUNET_CONTAINER_meta_data_insert (ret->meta, | ||
240 | "<gnunet>", | ||
241 | EXTRACTOR_METATYPE_FILENAME, | ||
242 | EXTRACTOR_METAFORMAT_C_STRING, | ||
243 | "text/plain", | ||
244 | fn, | ||
245 | strlen (fn) + 1); | ||
233 | return ret; | 246 | return ret; |
234 | } | 247 | } |
235 | 248 | ||
@@ -622,13 +635,12 @@ GNUNET_FS_file_information_create_from_directory (void *client_info, | |||
622 | struct EntryProcCls dc; | 635 | struct EntryProcCls dc; |
623 | struct GNUNET_FS_Uri *ksk; | 636 | struct GNUNET_FS_Uri *ksk; |
624 | struct GNUNET_CONTAINER_MetaData *meta; | 637 | struct GNUNET_CONTAINER_MetaData *meta; |
625 | 638 | const char *fn; | |
626 | 639 | const char *ss; | |
627 | 640 | ||
628 | dc.entries = NULL; | 641 | dc.entries = NULL; |
629 | meta = GNUNET_CONTAINER_meta_data_create (); | 642 | meta = GNUNET_CONTAINER_meta_data_create (); |
630 | GNUNET_FS_meta_data_make_directory (meta); | 643 | GNUNET_FS_meta_data_make_directory (meta); |
631 | |||
632 | scanner (scanner_cls, | 644 | scanner (scanner_cls, |
633 | filename, | 645 | filename, |
634 | do_index, | 646 | do_index, |
@@ -654,6 +666,18 @@ GNUNET_FS_file_information_create_from_directory (void *client_info, | |||
654 | GNUNET_FS_file_information_sync (dc.entries); | 666 | GNUNET_FS_file_information_sync (dc.entries); |
655 | dc.entries = dc.entries->next; | 667 | dc.entries = dc.entries->next; |
656 | } | 668 | } |
669 | fn = filename; | ||
670 | while (NULL != (ss = strstr (fn, | ||
671 | DIR_SEPARATOR_STR))) | ||
672 | fn = ss + 1; | ||
673 | GNUNET_CONTAINER_meta_data_insert (ret->meta, | ||
674 | "<gnunet>", | ||
675 | EXTRACTOR_METATYPE_FILENAME, | ||
676 | EXTRACTOR_METAFORMAT_C_STRING, | ||
677 | "text/plain", | ||
678 | fn, | ||
679 | strlen (fn) + 1); | ||
680 | ret->data.dir.dirname = GNUNET_strdup (filename); | ||
657 | GNUNET_FS_file_information_sync (ret); | 681 | GNUNET_FS_file_information_sync (ret); |
658 | return ret; | 682 | return ret; |
659 | } | 683 | } |