2005-02-20 04:17:07 -08:00
|
|
|
#ifndef ECORE_FILE_H
|
|
|
|
#define ECORE_FILE_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* TODO:
|
|
|
|
* - More events, move/rename of directory file
|
|
|
|
*/
|
|
|
|
|
2010-01-15 21:20:14 -08:00
|
|
|
#include <Eina.h>
|
|
|
|
|
2005-02-20 04:17:07 -08:00
|
|
|
#ifdef EAPI
|
2008-05-25 22:16:34 -07:00
|
|
|
# undef EAPI
|
2005-02-20 04:17:07 -08:00
|
|
|
#endif
|
2008-05-25 22:16:34 -07:00
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
# ifdef EFL_ECORE_FILE_BUILD
|
|
|
|
# ifdef DLL_EXPORT
|
|
|
|
# define EAPI __declspec(dllexport)
|
|
|
|
# else
|
|
|
|
# define EAPI
|
|
|
|
# endif /* ! DLL_EXPORT */
|
2005-02-20 04:17:07 -08:00
|
|
|
# else
|
|
|
|
# define EAPI __declspec(dllimport)
|
2008-05-25 22:16:34 -07:00
|
|
|
# endif /* ! EFL_ECORE_FILE_BUILD */
|
2005-02-20 04:17:07 -08:00
|
|
|
#else
|
2005-12-27 09:17:31 -08:00
|
|
|
# ifdef __GNUC__
|
|
|
|
# if __GNUC__ >= 4
|
|
|
|
# define EAPI __attribute__ ((visibility("default")))
|
|
|
|
# else
|
|
|
|
# define EAPI
|
|
|
|
# endif
|
2005-02-20 04:17:07 -08:00
|
|
|
# else
|
|
|
|
# define EAPI
|
|
|
|
# endif
|
2008-05-25 22:16:34 -07:00
|
|
|
#endif /* ! _WIN32 */
|
2005-02-20 04:17:07 -08:00
|
|
|
|
2007-08-06 13:00:28 -07:00
|
|
|
/**
|
|
|
|
* @file Ecore_File.h
|
|
|
|
* @brief Files utility functions
|
|
|
|
*/
|
|
|
|
|
2005-04-14 18:22:46 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2005-02-20 04:17:07 -08:00
|
|
|
|
2010-10-23 04:05:36 -07:00
|
|
|
/**
|
2011-01-27 12:40:02 -08:00
|
|
|
* @defgroup Ecore_File_Group Ecore_File - Files and directories convenience functions
|
2012-12-18 10:38:44 -08:00
|
|
|
* @ingroup Ecore
|
2010-10-23 04:05:36 -07:00
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @typedef Ecore_File_Monitor
|
|
|
|
* Abstract type used when monitoring a directory.
|
|
|
|
*/
|
2010-09-23 23:34:56 -07:00
|
|
|
typedef struct _Ecore_File_Monitor Ecore_File_Monitor;
|
2010-10-23 04:05:36 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @typedef Ecore_File_Download_Job
|
|
|
|
* Abstract type used when aborting a download.
|
|
|
|
*/
|
2010-09-23 23:34:56 -07:00
|
|
|
typedef struct _Ecore_File_Download_Job Ecore_File_Download_Job;
|
|
|
|
|
2010-10-23 04:05:36 -07:00
|
|
|
/**
|
2012-04-23 13:09:51 -07:00
|
|
|
* @typedef _Ecore_File_Event
|
2010-10-23 04:05:36 -07:00
|
|
|
* The event type returned when a file or directory is monitored.
|
|
|
|
*/
|
2010-10-25 06:08:40 -07:00
|
|
|
typedef enum _Ecore_File_Event
|
2010-10-23 04:05:36 -07:00
|
|
|
{
|
|
|
|
ECORE_FILE_EVENT_NONE, /**< No event. */
|
|
|
|
ECORE_FILE_EVENT_CREATED_FILE, /**< Created file event. */
|
|
|
|
ECORE_FILE_EVENT_CREATED_DIRECTORY, /**< Created directory event. */
|
|
|
|
ECORE_FILE_EVENT_DELETED_FILE, /**< Deleted file event. */
|
|
|
|
ECORE_FILE_EVENT_DELETED_DIRECTORY, /**< Deleted directory event. */
|
|
|
|
ECORE_FILE_EVENT_DELETED_SELF, /**< Deleted monitored directory event. */
|
2011-03-01 01:57:13 -08:00
|
|
|
ECORE_FILE_EVENT_MODIFIED, /**< Modified file or directory event. */
|
|
|
|
ECORE_FILE_EVENT_CLOSED /**< Closed file event */
|
2010-10-25 06:08:40 -07:00
|
|
|
} Ecore_File_Event;
|
2010-09-23 23:34:56 -07:00
|
|
|
|
2010-10-23 04:05:36 -07:00
|
|
|
/**
|
|
|
|
* @typedef Ecore_File_Monitor_Cb
|
|
|
|
* Callback type used when a monitored directory has changes.
|
|
|
|
*/
|
2010-10-16 16:02:35 -07:00
|
|
|
typedef void (*Ecore_File_Monitor_Cb)(void *data, Ecore_File_Monitor *em, Ecore_File_Event event, const char *path);
|
|
|
|
|
2010-10-23 04:33:56 -07:00
|
|
|
/**
|
|
|
|
* @typedef Ecore_File_Download_Completion_Cb
|
|
|
|
* Callback type used when a download is finished.
|
|
|
|
*/
|
|
|
|
typedef void (*Ecore_File_Download_Completion_Cb)(void *data, const char *file, int status);
|
|
|
|
|
2011-01-28 18:48:03 -08:00
|
|
|
/**
|
2012-04-23 13:09:51 -07:00
|
|
|
* @typedef _Ecore_File_Progress_Return
|
2011-01-28 18:48:03 -08:00
|
|
|
* What to do with the download as a return from the
|
|
|
|
* Ecore_File_Download_Progress_Cb function, if provided.
|
|
|
|
*/
|
|
|
|
typedef enum _Ecore_File_Progress_Return
|
|
|
|
{
|
|
|
|
ECORE_FILE_PROGRESS_CONTINUE = 0, /**< Continue the download. */
|
|
|
|
ECORE_FILE_PROGRESS_ABORT = 1 /**< Abort the download. */
|
|
|
|
} Ecore_File_Progress_Return;
|
|
|
|
|
2010-10-23 04:33:56 -07:00
|
|
|
/**
|
|
|
|
* @typedef Ecore_File_Download_Progress_Cb
|
2011-01-27 13:48:51 -08:00
|
|
|
* Callback type used while a download is in progress.
|
2010-10-23 04:33:56 -07:00
|
|
|
*/
|
|
|
|
typedef int (*Ecore_File_Download_Progress_Cb)(void *data,
|
|
|
|
const char *file,
|
|
|
|
long int dltotal,
|
|
|
|
long int dlnow,
|
|
|
|
long int ultotal,
|
|
|
|
long int ulnow);
|
|
|
|
|
2010-10-23 04:05:36 -07:00
|
|
|
/* File operations */
|
|
|
|
|
2010-09-23 23:34:56 -07:00
|
|
|
EAPI int ecore_file_init (void);
|
|
|
|
EAPI int ecore_file_shutdown (void);
|
|
|
|
EAPI long long ecore_file_mod_time (const char *file);
|
|
|
|
EAPI long long ecore_file_size (const char *file);
|
|
|
|
EAPI Eina_Bool ecore_file_exists (const char *file);
|
|
|
|
EAPI Eina_Bool ecore_file_is_dir (const char *file);
|
|
|
|
EAPI Eina_Bool ecore_file_mkdir (const char *dir);
|
|
|
|
EAPI int ecore_file_mkdirs (const char **dirs);
|
|
|
|
EAPI int ecore_file_mksubdirs (const char *base, const char **subdirs);
|
|
|
|
EAPI Eina_Bool ecore_file_rmdir (const char *dir);
|
|
|
|
EAPI Eina_Bool ecore_file_recursive_rm (const char *dir);
|
|
|
|
EAPI Eina_Bool ecore_file_mkpath (const char *path);
|
|
|
|
EAPI int ecore_file_mkpaths (const char **paths);
|
|
|
|
EAPI Eina_Bool ecore_file_cp (const char *src, const char *dst);
|
|
|
|
EAPI Eina_Bool ecore_file_mv (const char *src, const char *dst);
|
|
|
|
EAPI Eina_Bool ecore_file_symlink (const char *src, const char *dest);
|
|
|
|
EAPI char *ecore_file_realpath (const char *file);
|
|
|
|
EAPI Eina_Bool ecore_file_unlink (const char *file);
|
|
|
|
EAPI Eina_Bool ecore_file_remove (const char *file);
|
|
|
|
EAPI const char *ecore_file_file_get (const char *path);
|
|
|
|
EAPI char *ecore_file_dir_get (const char *path);
|
|
|
|
EAPI Eina_Bool ecore_file_can_read (const char *file);
|
|
|
|
EAPI Eina_Bool ecore_file_can_write (const char *file);
|
|
|
|
EAPI Eina_Bool ecore_file_can_exec (const char *file);
|
|
|
|
EAPI char *ecore_file_readlink (const char *link);
|
|
|
|
EAPI Eina_List *ecore_file_ls (const char *dir);
|
|
|
|
EAPI Eina_Iterator *ecore_file_ls_iterator (const char *dir);
|
|
|
|
EAPI char *ecore_file_app_exe_get (const char *app);
|
|
|
|
EAPI char *ecore_file_escape_name (const char *filename);
|
|
|
|
EAPI char *ecore_file_strip_ext (const char *file);
|
|
|
|
EAPI int ecore_file_dir_is_empty (const char *dir);
|
|
|
|
|
|
|
|
/* Monitoring */
|
|
|
|
|
|
|
|
EAPI Ecore_File_Monitor *ecore_file_monitor_add(const char *path,
|
2010-10-16 16:02:35 -07:00
|
|
|
Ecore_File_Monitor_Cb func,
|
2010-09-23 23:34:56 -07:00
|
|
|
void *data);
|
|
|
|
EAPI void ecore_file_monitor_del(Ecore_File_Monitor *ecore_file_monitor);
|
|
|
|
EAPI const char *ecore_file_monitor_path_get(Ecore_File_Monitor *ecore_file_monitor);
|
|
|
|
|
|
|
|
/* Path */
|
|
|
|
|
2010-09-24 22:34:26 -07:00
|
|
|
EAPI Eina_Bool ecore_file_path_dir_exists(const char *in_dir);
|
|
|
|
EAPI Eina_Bool ecore_file_app_installed(const char *exe);
|
2010-09-23 23:34:56 -07:00
|
|
|
EAPI Eina_List *ecore_file_app_list(void);
|
|
|
|
|
|
|
|
/* Download */
|
|
|
|
|
2010-09-24 22:34:26 -07:00
|
|
|
EAPI Eina_Bool ecore_file_download(const char *url,
|
2010-09-24 22:36:21 -07:00
|
|
|
const char *dst,
|
2010-10-23 04:33:56 -07:00
|
|
|
Ecore_File_Download_Completion_Cb completion_cb,
|
|
|
|
Ecore_File_Download_Progress_Cb progress_cb,
|
2010-09-24 22:36:21 -07:00
|
|
|
void *data,
|
|
|
|
Ecore_File_Download_Job **job_ret);
|
2011-02-16 04:44:34 -08:00
|
|
|
EAPI Eina_Bool ecore_file_download_full(const char *url,
|
|
|
|
const char *dst,
|
|
|
|
Ecore_File_Download_Completion_Cb completion_cb,
|
|
|
|
Ecore_File_Download_Progress_Cb progress_cb,
|
|
|
|
void *data,
|
|
|
|
Ecore_File_Download_Job **job_ret,
|
|
|
|
Eina_Hash *headers);
|
|
|
|
|
2010-09-24 22:36:21 -07:00
|
|
|
EAPI void ecore_file_download_abort_all(void);
|
|
|
|
EAPI void ecore_file_download_abort(Ecore_File_Download_Job *job);
|
2010-09-24 22:34:26 -07:00
|
|
|
EAPI Eina_Bool ecore_file_download_protocol_available(const char *protocol);
|
2005-06-15 18:54:12 -07:00
|
|
|
|
2010-10-23 04:05:36 -07:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2005-04-14 18:22:46 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2008-05-25 22:16:34 -07:00
|
|
|
|
2005-02-20 04:17:07 -08:00
|
|
|
#endif
|