eio_dir_copy() tutorial

To use eio_dir_copy(), you basically need the source and destination files (or directories), and set three callbacks:

Warning
It is the user's duty to provide the "right target". It means that copying to '.' will copy the content directly inside '.' and not in a subdirectory.

Here is a simple example:

#include <Ecore.h>
#include <Eio.h>
static void
_test_notify_cb(void *data, Eio_File *handler, const Eio_Progress *info)
{
switch (info->op)
{
printf("[%s] %f%%\n", info->dest, info->percent);
break;
printf("global [%li/%li] %f%%\n", info->current, info->max, info->percent);
break;
}
}
static void
_test_done_cb(void *data, Eio_File *handler)
{
printf("copy done\n");
}
static void
_test_error_cb(int error, Eio_File *handler, void *data)
{
fprintf(stderr, "error: [%s]\n", strerror(error));
}
int
main(int argc, char **argv)
{
Eio_File *cp;
if (argc != 3)
{
fprintf(stderr, "eio_cp source_file destination_file\n");
return -1;
}
cp = eio_dir_copy(argv[1], argv[2],
_test_notify_cb,
_test_done_cb,
_test_error_cb,
NULL);
return 0;
}