Beispiel #1
0
std::size_t add(
         Catalog& cat,
         boost::filesystem::path const& path,
         const bool recurse,
         const std::size_t search_depth
         ) {
   if( ! exists(path) ) BOOST_THROW_EXCEPTION(
            Input_err()
            << Input_err::msg_t("not found")
            << Input_err::str1_t(path.string())
   );
   if( is_directory(path) ) {
      if( recurse ) {
         boost::filesystem::recursive_directory_iterator i1(path), i2;
         return add_to_catalog(i1, i2, cat, search_depth);
      } else {
         boost::filesystem::directory_iterator i1(path), i2;
         return add_to_catalog(i1, i2, cat, search_depth);
      }
   } else if( is_regular_file(path) ) {
      return add_to_catalog(path, cat, search_depth, false);
   }
   return 0;
}
Beispiel #2
0
void
gth_browser_add_to_catalog (GthBrowser *browser,
  			    GFile      *catalog)
{
	GList *items;
	GList *file_list;
	GList *files;

	items = gth_file_selection_get_selected (GTH_FILE_SELECTION (gth_browser_get_file_list_view (browser)));
	file_list = gth_file_list_get_files (GTH_FILE_LIST (gth_browser_get_file_list (browser)), items);
	files = gth_file_data_list_to_file_list (file_list);
	if (files != NULL)
		add_to_catalog (browser, catalog, files);

	_g_object_list_unref (files);
	_g_object_list_unref (file_list);
	_gtk_tree_path_list_free (items);
}