To use eio_dir_copy(), you basically need the source and destination files (or directories), and set three callbacks:
- The notification callback, which allows you to know if a file or a directory is copied, and the progress of the copy.
- The end callback, which is called when the copy is finished.
- The error callback, which is called if an error occurred. You can then retrieve the error type as an errno error.
- 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
{
{
break;
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)
{
if (argc != 3)
{
fprintf(stderr, "eio_cp source_file destination_file\n");
return -1;
}
_test_notify_cb,
_test_done_cb,
_test_error_cb,
NULL);
return 0;
}
Represents the current progress of the operation.
Definition: Eio_Legacy.h:172
float percent
Percent done for the I/O operation.
Definition: Eio_Legacy.h:177
void ecore_main_loop_quit(void)
Quits the main loop once all the events currently on the queue have been processed.
Definition: ecore_main.c:1300
const char * dest
target of the I/O operation
Definition: Eio_Legacy.h:180
@ EIO_DIR_COPY
I/O operation is about a specific directory copy.
Definition: Eio_Legacy.h:107
int eio_shutdown(void)
Shutdown eio and all its submodule if possible.
Definition: eio_main.c:340
long long current
Current step in the I/O operation.
Definition: Eio_Legacy.h:175
EAPI Eio_File * eio_dir_copy(const char *source, const char *dest, Eio_Filter_Direct_Cb filter_cb, Eio_Progress_Cb progress_cb, Eio_Done_Cb done_cb, Eio_Error_Cb error_cb, const void *data)
Copy a directory and its content asynchronously.
Definition: eio_dir.c:849
@ EIO_FILE_COPY
I/O operation is about a specific file copy.
Definition: Eio_Legacy.h:105
int eio_init(void)
Initialize eio and all its required submodule.
Definition: eio_main.c:276
void ecore_main_loop_begin(void)
Runs the application main loop.
Definition: ecore_main.c:1290
Eio_File_Op op
I/O type.
Definition: Eio_Legacy.h:173
EAPI int ecore_shutdown(void)
Shuts down connections, signal handlers sockets etc.
Definition: ecore.c:373
long long max
Number of total steps to complete this I/O.
Definition: Eio_Legacy.h:176
struct _Eio_File Eio_File
Definition: Eio.h:72
EAPI int ecore_init(void)
Sets up connections, signal handlers, sockets etc.
Definition: ecore.c:229