Пример #1
0
/**
 * gs_file_enumerator_iterate:
 * @direnum: an open #GFileEnumerator
 * @out_info: (out) (transfer none) (allow-none): Output location for the next #GFileInfo
 * @out_child: (out) (transfer none) (allow-none): Output location for the next #GFile, or %NULL
 * @cancellable: a #GCancellable
 * @error: a #GError
 *
 * This is a version of g_file_enumerator_next_file() that's easier to
 * use correctly from C programs.  With g_file_enumerator_next_file(),
 * the gboolean return value signifies "end of iteration or error", which
 * requires allocation of a temporary #GError.
 *
 * In contrast, with this function, a %FALSE return from
 * gs_file_enumerator_iterate() <emphasis>always</emphasis> means
 * "error".  End of iteration is signaled by @out_info being %NULL.
 *
 * Another crucial difference is that the references for @out_info and
 * @out_child are owned by @direnum (they are cached as hidden
 * properties).  You must not unref them in your own code.  This makes
 * memory management significantly easier for C code in combination
 * with loops.
 *
 * Finally, this function optionally allows retrieving a #GFile as
 * well.
 *
 * The code pattern for correctly using gs_file_enumerator_iterate() from C
 * is:
 *
 * |[
 * direnum = g_file_enumerate_children (file, ...);
 * while (TRUE)
 *   {
 *     GFileInfo *info;
 *     if (!gs_file_enumerator_iterate (direnum, &info, NULL, cancellable, error))
 *       goto out;
 *     if (!info)
 *       break;
 *     ... do stuff with "info"; do not unref it! ...
 *   }
 *
 * out:
 *   g_object_unref (direnum); // Note: frees the last @info
 * ]|
 */
gboolean
gs_file_enumerator_iterate (GFileEnumerator  *direnum,
                            GFileInfo       **out_info,
                            GFile           **out_child,
                            GCancellable     *cancellable,
                            GError          **error)
{
    gboolean ret = FALSE;
    GError *temp_error = NULL;

    static GQuark cached_info_quark;
    static GQuark cached_child_quark;
    static gsize quarks_initialized;

    g_return_val_if_fail (direnum != NULL, FALSE);
    g_return_val_if_fail (out_info != NULL, FALSE);

    if (g_once_init_enter (&quarks_initialized))
    {
        cached_info_quark = g_quark_from_static_string ("gsystem-cached-info");
        cached_child_quark = g_quark_from_static_string ("gsystem-cached-child");
        g_once_init_leave (&quarks_initialized, 1);
    }


    *out_info = g_file_enumerator_next_file (direnum, cancellable, &temp_error);
    if (out_child)
        *out_child = NULL;
    if (temp_error != NULL)
    {
        g_propagate_error (error, temp_error);
        goto out;
    }
    else if (*out_info != NULL)
    {
        g_object_set_qdata_full ((GObject*)direnum, cached_info_quark, *out_info, (GDestroyNotify)g_object_unref);
        if (out_child != NULL)
        {
            const char *name = g_file_info_get_name (*out_info);
            *out_child = g_file_get_child (g_file_enumerator_get_container (direnum), name);
            g_object_set_qdata_full ((GObject*)direnum, cached_child_quark, *out_child, (GDestroyNotify)g_object_unref);
        }
    }

    ret = TRUE;
out:
    return ret;
}
Пример #2
0
static void
enumerate_next_files_ready_cb (GObject *source,
                               GAsyncResult *res,
                               gpointer user_data)
{
  GFileEnumerator *enumerator = G_FILE_ENUMERATOR (source);
  BijiNoteBook *self;
  GList *files, *l;
  GError *error = NULL;
  gchar *base_path;

  files = g_file_enumerator_next_files_finish (enumerator, res, &error);

  if (error != NULL)
    {
      load_location_error (g_file_enumerator_get_container (enumerator), error);
      return;
    }

  self = user_data;
  base_path = g_file_get_path (self->priv->location);

  // now load the notes
  for (l = files; l != NULL; l = l->next)
    {
      GFileInfo *info;
      const gchar *name;
      gchar *path;
      BijiNoteObj *note;

      info = l->data;
      name = g_file_info_get_name (info);

      if (!g_str_has_suffix (name, ".note"))
        continue;

      path = g_build_filename (base_path, name, NULL);
      note = biji_note_get_new_from_file (path);

      _biji_note_book_add_one_note (self, note);

      g_free (path);
    }

  g_free (base_path);
  g_list_free_full (files, g_object_unref);
}
static void
file_info_async_ready (GObject      *source,
                       GAsyncResult *res,
                       gpointer      user_data)
{
  BgPicturesSource *bg_source;
  GList *files, *l;
  GError *err = NULL;
  GFile *parent;

  files = g_file_enumerator_next_files_finish (G_FILE_ENUMERATOR (source),
                                               res,
                                               &err);
  if (err)
    {
      if (!g_error_matches (err, G_IO_ERROR, G_IO_ERROR_CANCELLED))
        g_warning ("Could not get pictures file information: %s", err->message);
      g_error_free (err);

      g_list_foreach (files, (GFunc) g_object_unref, NULL);
      g_list_free (files);
      return;
    }

  bg_source = BG_PICTURES_SOURCE (user_data);

  parent = g_file_enumerator_get_container (G_FILE_ENUMERATOR (source));

  files = g_list_sort (files, file_sort_func);

  /* iterate over the available files */
  for (l = files; l; l = g_list_next (l))
    {
      GFileInfo *info = l->data;
      GFile *file;

      file = g_file_get_child (parent, g_file_info_get_name (info));

      add_single_file_from_info (bg_source, file, info, NULL);
    }

  g_list_foreach (files, (GFunc) g_object_unref, NULL);
  g_list_free (files);
}
Пример #4
0
static void
gnac_profiles_mgr_import_default_profiles(void)
{
  gnac_profiles_mgr_clear();

  GFileEnumerator *files = gnac_profiles_mgr_get_default_profiles_enumerator();

  GFile *profile_file = g_file_enumerator_get_container(files);
  gchar *profile_file_path = g_file_get_path(profile_file);

  GFileInfo *file_info;
  while ((file_info = g_file_enumerator_next_file(files, NULL, NULL))) {
    if (g_file_info_get_file_type(file_info) == G_FILE_TYPE_REGULAR) {
      GError *error = NULL;
      const gchar *profile_file_name = g_file_info_get_name(file_info);
      gchar *profile_file_full_path = g_build_filename(profile_file_path,
          profile_file_name, NULL);
      gpointer profile = gnac_profiles_properties_load_profile_from_file(
          profile_file_full_path, profile_file_name, &error);

      if (profile) {
        gnac_profiles_properties_save_profile(profile);
      } else if (error) {
        libgnac_warning("%s", error->message);
        g_clear_error(&error);
      }

      g_free(profile_file_full_path);
      gnac_profiles_properties_free_audio_profile(profile);
    }

    g_object_unref(file_info);
  }

  g_free(profile_file_path);
  g_file_enumerator_close(files, NULL, NULL);
  g_object_unref(files);
}
Пример #5
0
static void
enumerate_next_files_async_cb (GObject *source,
                               GAsyncResult *res,
                               gpointer user_data)
{
  EnumerateJob *job = user_data;
  GList *enumerated_files, *l;
  GFileInfo *info;
  GSList *logs;
  const char *content_type, *name;
  char *parse_string, *container_path;
  GFileType type;
  GFile *container;

  enumerated_files = g_file_enumerator_next_files_finish (G_FILE_ENUMERATOR (source),
                                                          res, NULL);
  if (!enumerated_files) {
    enumerate_job_finish (job);
    return;
  }

  logs = job->logs;
  container = g_file_enumerator_get_container (G_FILE_ENUMERATOR (source));
  container_path = g_file_get_path (container);

  /* TODO: we don't support grouping rotated logs yet, skip gzipped files
   * and those which name contains a formatted date.
   */
  for (l = enumerated_files; l; l = l->next) {
    info = l->data;
    type = g_file_info_get_file_type (info);
    content_type = g_file_info_get_content_type (info);
    name = g_file_info_get_name (info);
    
    if (!g_file_info_get_attribute_boolean (info, "access::can-read")) {
      g_object_unref (info);
      continue;
    }

    if (type != (G_FILE_TYPE_REGULAR || G_FILE_TYPE_SYMBOLIC_LINK) ||
        !g_content_type_is_a (content_type, "text/plain"))
    {
      g_object_unref (info);
      continue;
    }

    if (g_content_type_is_a (content_type, "application/x-gzip")) {
      g_object_unref (info);
      continue;
    }

    if (g_regex_match_simple ("\\d{8}$", name, 0, 0)) {
      g_object_unref (info);
      continue;
    }

    parse_string = g_build_filename (container_path, name, NULL);

    if (g_slist_find_custom (logs, parse_string, (GCompareFunc) g_ascii_strcasecmp) == NULL) {
      logs = g_slist_append (logs, parse_string);
    } else {
      g_free (parse_string);
    }

    g_object_unref (info);
    parse_string = NULL;
  }

  g_list_free (enumerated_files);
  g_object_unref (container);
  g_free (container_path);

  job->logs = logs;

  enumerate_job_finish (job);
}
Пример #6
0
static void
gnac_profiles_mgr_populate(void)
{ 
  gnac_profiles_mgr_clear();

  GError *error = NULL;

  GFile *dir = g_file_new_for_path(saved_profiles_dir);
  if (!g_file_query_exists(dir, NULL)) {
    if (!g_file_make_directory_with_parents(dir, NULL, &error)) {
      const gchar *msg = N_("Unable to create the profiles directory");
      libgnac_warning("%s %s: %s",
          msg, _("You may not be able to save your profiles"), error->message);
      gnac_profiles_mgr_display_status_message(NULL, msg);
      g_clear_error(&error);
      return;
    } else {
      gnac_profiles_mgr_import_default_profiles();
    }
  }

  GFileEnumerator *files = g_file_enumerate_children(dir,
      G_FILE_ATTRIBUTE_STANDARD_NAME ","
      G_FILE_ATTRIBUTE_STANDARD_TYPE,
      G_FILE_QUERY_INFO_NONE, NULL, &error);
  if (!files && error) {
    const gchar *msg = N_("Unable to browse the profiles directory");
    libgnac_warning("%s: %s", msg, error->message);
    gnac_profiles_mgr_display_status_message(NULL, msg);
    g_clear_error(&error);
    return;
  }

  GFileInfo *file_info = g_file_enumerator_next_file(files, NULL, NULL);
  if (!file_info) {
    gnac_profiles_mgr_import_default_profiles();
    g_file_enumerator_close(files, NULL, NULL);
    files = g_file_enumerate_children(dir,
        G_FILE_ATTRIBUTE_STANDARD_NAME ","
        G_FILE_ATTRIBUTE_STANDARD_TYPE,
        G_FILE_QUERY_INFO_NONE, NULL, &error);
    file_info = g_file_enumerator_next_file(files, NULL, NULL);
  }

  GFile *profile_file = g_file_enumerator_get_container(files);
  gchar *profile_file_path = g_file_get_path(profile_file);

  while (file_info) {
    if (g_file_info_get_file_type(file_info) == G_FILE_TYPE_REGULAR) {
      const gchar *profile_file_name = g_file_info_get_name(file_info);
      gchar *profile_file_full_path = g_build_filename(profile_file_path,
          profile_file_name, NULL);
      gpointer profile = gnac_profiles_properties_load_profile_from_file(
          profile_file_full_path, profile_file_name, &error);

      g_free(profile_file_full_path);

      if (profile) {
        gnac_profiles_mgr_insert(profile);
      } else if (error) {
        libgnac_warning("%s", error->message);
        g_clear_error(&error);
      }
    }

    g_object_unref(file_info);
    file_info = g_file_enumerator_next_file(files, NULL, NULL);
  }

  gnac_profiles_mgr_display_status_message(NULL, NULL);

  g_object_unref(dir);
  g_free(profile_file_path);
  g_file_enumerator_close(files, NULL, NULL);
  g_object_unref(files);
}
Пример #7
0
void
gnac_profiles_mgr_list_profiles(void)
{
  GFile *dir = gnac_profiles_mgr_get_profiles_dir();

  GError *error = NULL;
  GFileEnumerator *files = g_file_enumerate_children(dir,
      G_FILE_ATTRIBUTE_STANDARD_NAME ","
      G_FILE_ATTRIBUTE_STANDARD_TYPE,
      G_FILE_QUERY_INFO_NONE, NULL, &error);

  if (!files && error) {
    g_clear_error(&error);
    /* no profiles found, try to import the default ones */
    gnac_profiles_mgr_import_default_profiles();
    files = g_file_enumerate_children(dir,
        G_FILE_ATTRIBUTE_STANDARD_NAME ","
        G_FILE_ATTRIBUTE_STANDARD_TYPE,
        G_FILE_QUERY_INFO_NONE, NULL, &error);
    if (!files && error) {
      g_printerr(_("No profiles available"));
      libgnac_warning("%s", error->message);
      g_clear_error(&error);
      return;
    }
  }

  g_print(_("Available audio profiles:"));
  g_print("\n\n");

  gchar *last_used_profile = gnac_settings_get_string(
      GNAC_KEY_LAST_USED_PROFILE);

  GFile *profile_file = g_file_enumerator_get_container(files);
  gchar *profile_file_path = g_file_get_path(profile_file);

  GFileInfo *file_info;
  GSList *profiles = NULL;

  while ((file_info = g_file_enumerator_next_file(files, NULL, NULL))) {
    if (g_file_info_get_file_type(file_info) == G_FILE_TYPE_REGULAR) {
      AudioProfileGeneric *profile;
      const gchar *profile_file_name = g_file_info_get_name(file_info);
      gchar *profile_file_full_path = g_build_filename(profile_file_path,
          profile_file_name, NULL);
      gnac_profiles_default_load_generic_audio_profile(profile_file_full_path,
          &profile);
      if (profile) {
        gpointer name = (profile->generic)->name;
        profiles = g_slist_prepend(profiles, name);
      }

      g_free(profile_file_full_path);
    }

    g_object_unref(file_info);
  }

  g_free(profile_file_path);

  profiles = g_slist_reverse(profiles);

  guint count = g_slist_length(profiles);
  if (count == 0) {
    g_print("\t");
    g_print(_("No profiles available"));
    g_print("\n");
  } else {
    /* check if last_used_profile exists */
    if (!g_slist_find_custom(profiles, last_used_profile,
        (GCompareFunc) g_strcmp0))
    {
      last_used_profile = NULL;
    }

    GSList *tmp;
    for (tmp = profiles; tmp; tmp = g_slist_next(tmp)) {
      gint pos = g_slist_position(profiles, tmp);
      gchar *count_str = g_strdup_printf("%u", pos+1);
      /* if last_used_profile is not set, assume the
       * first profile was last used */
      gchar *name = tmp->data;
      gboolean found = ((pos == 0 && !last_used_profile)
          || gnac_utils_str_equal(name, last_used_profile));
      g_print("\t%2s) %s\n", found ? "*" : count_str, name);
      g_free(count_str);
    }
  }

  g_print("\n");

  g_slist_free(profiles);
  g_free(last_used_profile);
  g_object_unref(dir);
  g_file_enumerator_close(files, NULL, NULL);
  g_object_unref(files);
}
Пример #8
0
static gboolean fm_dir_list_job_run_gio(FmDirListJob* job)
{
    GFileEnumerator *enu;
    GFileInfo *inf;
    FmFileInfo* fi;
    GError *err = NULL;
    FmJob* fmjob = FM_JOB(job);
    GFile* gf;
    const char* query;

    gf = fm_path_to_gfile(job->dir_path);
_retry:
    inf = g_file_query_info(gf, gfile_info_query_attribs, 0, fm_job_get_cancellable(fmjob), &err);
    if(!inf )
    {
        FmJobErrorAction act = fm_job_emit_error(fmjob, err, FM_JOB_ERROR_MODERATE);
        g_error_free(err);
        if( act == FM_JOB_RETRY )
        {
            err = NULL;
            goto _retry;
        }
        else
        {
            g_object_unref(gf);
            return FALSE;
        }
    }

    if( g_file_info_get_file_type(inf) != G_FILE_TYPE_DIRECTORY)
    {
        char *path_str = fm_path_to_str(job->dir_path);
        err = g_error_new(G_IO_ERROR, G_IO_ERROR_NOT_DIRECTORY,
                          _("The specified directory '%s' is not valid"),
                          path_str);
        fm_job_emit_error(fmjob, err, FM_JOB_ERROR_CRITICAL);
        g_free(path_str);
        g_error_free(err);
        g_object_unref(gf);
        g_object_unref(inf);
        return FALSE;
    }

    /* check if FS is R/O and set attr. into inf */
    _fm_file_info_job_update_fs_readonly(gf, inf, NULL, NULL);

    job->dir_fi = fm_file_info_new_from_g_file_data(gf, inf, job->dir_path);
    g_object_unref(inf);

    if(G_UNLIKELY(job->flags & FM_DIR_LIST_JOB_DIR_ONLY))
    {
        query = G_FILE_ATTRIBUTE_STANDARD_TYPE","G_FILE_ATTRIBUTE_STANDARD_NAME","
                G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN","G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP","
                G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK","G_FILE_ATTRIBUTE_STANDARD_IS_VIRTUAL","
                G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME","
                G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME","G_FILE_ATTRIBUTE_STANDARD_ICON","
                G_FILE_ATTRIBUTE_STANDARD_SIZE","G_FILE_ATTRIBUTE_STANDARD_TARGET_URI","
                "unix::*,time::*,access::*,id::filesystem";
    }
    else
        query = gfile_info_query_attribs;

    enu = g_file_enumerate_children (gf, query, 0, fm_job_get_cancellable(fmjob), &err);
    g_object_unref(gf);
    if(enu)
    {
        while( ! fm_job_is_cancelled(fmjob) )
        {
            inf = g_file_enumerator_next_file(enu, fm_job_get_cancellable(fmjob), &err);
            if(inf)
            {
                FmPath *dir, *sub;
                GFile *child;
                if(G_UNLIKELY(job->flags & FM_DIR_LIST_JOB_DIR_ONLY))
                {
                    /* FIXME: handle symlinks */
                    if(g_file_info_get_file_type(inf) != G_FILE_TYPE_DIRECTORY)
                    {
                        g_object_unref(inf);
                        continue;
                    }
                }

                /* virtual folders may return children not within them */
                dir = fm_path_new_for_gfile(g_file_enumerator_get_container(enu));
                if (fm_path_equal(job->dir_path, dir))
                    sub = fm_path_new_child(job->dir_path, g_file_info_get_name(inf));
                else
                    sub = fm_path_new_child(dir, g_file_info_get_name(inf));
                child = g_file_get_child(g_file_enumerator_get_container(enu),
                                         g_file_info_get_name(inf));
                if (g_file_info_get_file_type(inf) == G_FILE_TYPE_DIRECTORY)
                    /* for dir: check if its FS is R/O and set attr. into inf */
                    _fm_file_info_job_update_fs_readonly(child, inf, NULL, NULL);
                fi = fm_file_info_new_from_g_file_data(child, inf, sub);
                fm_path_unref(sub);
                fm_path_unref(dir);
                g_object_unref(child);
                fm_dir_list_job_add_found_file(job, fi);
                fm_file_info_unref(fi);
            }
            else
            {
                if(err)
                {
                    FmJobErrorAction act = fm_job_emit_error(fmjob, err, FM_JOB_ERROR_MILD);
                    g_error_free(err);
                    /* FM_JOB_RETRY is not supported. */
                    if(act == FM_JOB_ABORT)
                        fm_job_cancel(fmjob);
                }
                /* otherwise it's EOL */
                break;
            }
            g_object_unref(inf);
        }
        g_file_enumerator_close(enu, NULL, &err);
        g_object_unref(enu);
    }
    else
    {
        fm_job_emit_error(fmjob, err, FM_JOB_ERROR_CRITICAL);
        g_error_free(err);
        return FALSE;
    }
    return TRUE;
}
Пример #9
0
static VALUE
fileenumerator_get_container(VALUE self)
{
        return GOBJ2RVAL(g_file_enumerator_get_container(_SELF(self)));
}
Пример #10
0
static void
enum_files_cb (GObject *obj, GAsyncResult *result, gpointer data)
{
	RBAndroidSource *source = RB_ANDROID_SOURCE (data);
	RBAndroidSourcePrivate *priv = GET_PRIVATE(source);
	GFileEnumerator *e = G_FILE_ENUMERATOR (obj);
	GError *error = NULL;
	GFileInfo *info;
	GList *files;
	GList *l;

	files = g_file_enumerator_next_files_finish (e, result, &error);
	if (error != NULL) {
		rb_debug ("error listing files: %s", error->message);
		music_dirs_done (source);
		return;
	}

	if (files == NULL) {
		priv->scanned++;
		g_object_unref (e);
		find_music_dirs (source);
		return;
	}

	for (l = files; l != NULL; l = l->next) {
		guint32 filetype;
		info = (GFileInfo *)l->data;

		filetype = g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_STANDARD_TYPE);
		if (filetype == G_FILE_TYPE_DIRECTORY) {
			GFile *dir;
			if (priv->scanned == 0) {

				rb_debug ("got storage container %s", g_file_info_get_name (info));
				dir = g_file_get_child (g_file_enumerator_get_container (e), g_file_info_get_name (info));
				g_queue_push_tail (&priv->to_scan, dir);
			} else if (g_ascii_strcasecmp (g_file_info_get_name (info), "music") == 0) {
				GFile *storage;
				char *uri;

				storage = g_file_enumerator_get_container (e);
				dir = g_file_get_child (storage, g_file_info_get_name (info));
				uri = g_file_get_uri (dir);
				rb_debug ("music dir found at %s", uri);

				/* keep the container around for space/capacity calculation */
				priv->storage = g_list_append (priv->storage, dir);

				rhythmdb_import_job_add_uri (priv->import_job, uri);
				g_free (uri);
			}
		}

		g_object_unref (info);
	}

	g_list_free (files);

	g_file_enumerator_next_files_async (G_FILE_ENUMERATOR (obj), 64, G_PRIORITY_DEFAULT, priv->cancel, enum_files_cb, source);
}
Пример #11
0
int qaul_copyDirectory(char* source, char* target)
{
	// g_file_copy: https://developer.gnome.org/gio/stable/GFile.html#g-file-copy
	// Permissions: http://www.gnu.org/software/libc/manual/html_node/Permission-Bits.html
	// glib-file-utilities: https://developer.gnome.org/glib/2.37/glib-File-Utilities.html
	const gchar *fileName;
	char sourcePath[MAX_PATH_LEN], targetPath[MAX_PATH_LEN];
	GFile *sourceFile, *targetFile;
	GFileEnumerator* enumerator;
	GFileInfo *fileInfo;
	GError *error = NULL;

	printf("qaul_copyDirectory: %s -> %s\n", source, target);

	// test if source path is a directory
	if(g_file_test(source, G_FILE_TEST_IS_DIR))
	{
		// check if directory exists & create it otherwise
		if(!g_file_test(target, G_FILE_TEST_EXISTS) && g_mkdir(target, S_IRUSR|S_IWUSR|S_IXUSR)==-1)
		{
			printf("qaul.net home directory %s creation error.\n", target);
			return 0;
		}
		else
		{
			// get directories files
			sourceFile = g_file_new_for_path(source);
			enumerator = g_file_enumerate_children(sourceFile, "*", G_FILE_QUERY_INFO_NONE, NULL, &error);

			// loop through the directories files
			fileInfo = g_file_enumerator_next_file(enumerator, NULL, &error);
			while(fileInfo != NULL)
			{
				// copy regular files
				if(g_file_info_get_file_type(fileInfo) == G_FILE_TYPE_REGULAR)
				{
					// get source file
					fileName = g_file_info_get_name(fileInfo);
					sourceFile = g_file_get_child(g_file_enumerator_get_container(enumerator), fileName);
					// create target path
					sprintf(targetPath, "%s/%s", target, fileName);
					targetFile = g_file_new_for_path(targetPath);
					if(!g_file_copy(sourceFile, targetFile, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, &error))
					{
						printf("qaul_copyDirectory copy file error: %s\n", (char*)error->message);
					}
				}
				// recursively copy directories
				else if(g_file_info_get_file_type(fileInfo) == G_FILE_TYPE_DIRECTORY)
				{
					fileName = g_file_info_get_name(fileInfo);
					sprintf(sourcePath, "%s/%s", source, fileName);
					sprintf(targetPath, "%s/%s", target, fileName);
					if(!qaul_copyDirectory(sourcePath, targetPath))
						printf("qaul_copyDirectory error copying %s -> %s", sourcePath, targetPath);
				}

				// free file info
				g_object_unref(fileInfo);
				fileInfo = g_file_enumerator_next_file(enumerator, NULL, &error);
			}
		}
		return 1;
	}
	else
		printf("qaul_copyDirectoryRecursively source is not a directory error: %s\n", source);
/*
	else
	{
		sourcefile = g_file_new_for_path(source);
		targetfile = g_file_new_for_path(target);
		if(!g_file_copy(sourcefile, targetfile, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, &error))
		{
			printf("qaul_copyDirectory error: %s\n", (char*)error->message);
			return 0;
		}
	}
*/
	return 0;
}