+ GNUNET_FS_uri_ksk_add_keyword (item->ksk_uri, GNUNET_FS_DIRECTORY_MIME,
+ GNUNET_NO);
+ fi = GNUNET_FS_file_information_create_empty_directory (ctx, NULL,
+ item->ksk_uri,
+ item->meta,
+ &bo, item->filename);
+ for (child = item->children_head; child; child = child->next)
+ {
+ fic = get_file_information (child);
+ GNUNET_break (GNUNET_OK == GNUNET_FS_file_information_add (fi, fic));
+ }
+ }
+ else
+ {
+ fi = GNUNET_FS_file_information_create_from_file (ctx, NULL,
+ item->filename,
+ item->ksk_uri, item->meta,
+ !do_insert,
+ &bo);
+ }
+ return fi;
+}
+
+
+/**
+ * We've finished scanning the directory and optimized the meta data.
+ * Begin the publication process.
+ *
+ * @param directory_scan_result result from the directory scan, freed in this function
+ */
+static void
+directory_trim_complete (struct GNUNET_FS_ShareTreeItem *directory_scan_result)
+{
+ struct GNUNET_FS_FileInformation *fi;
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv;
+
+ fi = get_file_information (directory_scan_result);
+ GNUNET_FS_share_tree_free (directory_scan_result);
+ if (NULL == fi)
+ {
+ FPRINTF (stderr,
+ "%s",
+ _("Could not publish\n"));
+ GNUNET_SCHEDULER_shutdown ();
+ ret = 1;
+ return;
+ }
+ GNUNET_FS_file_information_inspect (fi, &publish_inspector, NULL);
+ if (extract_only)
+ {
+ GNUNET_FS_file_information_destroy (fi, NULL, NULL);
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+ if (NULL == namespace)
+ priv = NULL;
+ else
+ priv = GNUNET_IDENTITY_ego_get_private_key (namespace);
+ pc = GNUNET_FS_publish_start (ctx, fi,
+ priv, this_id, next_id,
+ (do_simulate) ?
+ GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY :
+ GNUNET_FS_PUBLISH_OPTION_NONE);
+ if (NULL == pc)
+ {
+ FPRINTF (stderr,
+ "%s",
+ _("Could not start publishing.\n"));
+ GNUNET_SCHEDULER_shutdown ();
+ ret = 1;
+ return;
+ }
+}
+
+
+/**
+ * Function called by the directory scanner as we build the tree
+ * that we will need to publish later.
+ *
+ * @param cls closure
+ * @param filename which file we are making progress on
+ * @param is_directory #GNUNET_YES if this is a directory,
+ * #GNUNET_NO if this is a file
+ * #GNUNET_SYSERR if it is neither (or unknown)
+ * @param reason kind of progress we are making
+ */
+static void
+directory_scan_cb (void *cls,
+ const char *filename,
+ int is_directory,
+ enum GNUNET_FS_DirScannerProgressUpdateReason reason)
+{
+ struct GNUNET_FS_ShareTreeItem *directory_scan_result;
+
+ switch (reason)
+ {
+ case GNUNET_FS_DIRSCANNER_FILE_START:
+ if (verbose > 1)