c7feddab1224e15143fcd3d6472ac2c0fbb7dff7
[profile/ivi/ecore.git] / src / lib / ecore_file / Ecore_File.h
1 #ifndef ECORE_FILE_H
2 #define ECORE_FILE_H
3
4 /*
5  * TODO:
6  * - More events, move/rename of directory file
7  */
8
9 #include <Eina.h>
10
11 #ifdef EAPI
12 # undef EAPI
13 #endif
14
15 #ifdef _WIN32
16 # ifdef EFL_ECORE_FILE_BUILD
17 #  ifdef DLL_EXPORT
18 #   define EAPI __declspec(dllexport)
19 #  else
20 #   define EAPI
21 #  endif /* ! DLL_EXPORT */
22 # else
23 #  define EAPI __declspec(dllimport)
24 # endif /* ! EFL_ECORE_FILE_BUILD */
25 #else
26 # ifdef __GNUC__
27 #  if __GNUC__ >= 4
28 #   define EAPI __attribute__ ((visibility("default")))
29 #  else
30 #   define EAPI
31 #  endif
32 # else
33 #  define EAPI
34 # endif
35 #endif /* ! _WIN32 */
36
37 /**
38  * @file Ecore_File.h
39  * @brief Files utility functions
40  */
41
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45
46    typedef struct _Ecore_File_Monitor       Ecore_File_Monitor;
47    typedef struct _Ecore_File_Monitor_Event Ecore_File_Monitor_Event;
48    typedef struct _Ecore_File_Download_Job  Ecore_File_Download_Job;
49
50    typedef enum
51      {
52         ECORE_FILE_EVENT_NONE,
53           ECORE_FILE_EVENT_CREATED_FILE,
54           ECORE_FILE_EVENT_CREATED_DIRECTORY,
55           ECORE_FILE_EVENT_DELETED_FILE,
56           ECORE_FILE_EVENT_DELETED_DIRECTORY,
57           ECORE_FILE_EVENT_DELETED_SELF,
58           ECORE_FILE_EVENT_MODIFIED
59      } Ecore_File_Event;
60
61
62    EAPI int         ecore_file_init         (void);
63    EAPI int         ecore_file_shutdown     (void);
64    EAPI long long   ecore_file_mod_time     (const char *file);
65    EAPI long long   ecore_file_size         (const char *file);
66    EAPI Eina_Bool   ecore_file_exists       (const char *file);
67    EAPI Eina_Bool   ecore_file_is_dir       (const char *file);
68    EAPI Eina_Bool   ecore_file_mkdir        (const char *dir);
69    EAPI int         ecore_file_mkdirs       (const char **dirs);
70    EAPI int         ecore_file_mksubdirs    (const char *base, const char **subdirs);
71    EAPI Eina_Bool   ecore_file_rmdir        (const char *dir);
72    EAPI Eina_Bool   ecore_file_recursive_rm (const char *dir);
73    EAPI Eina_Bool   ecore_file_mkpath       (const char *path);
74    EAPI int         ecore_file_mkpaths      (const char **paths);
75    EAPI Eina_Bool   ecore_file_cp           (const char *src, const char *dst);
76    EAPI Eina_Bool   ecore_file_mv           (const char *src, const char *dst);
77    EAPI Eina_Bool   ecore_file_symlink      (const char *src, const char *dest);
78    EAPI char       *ecore_file_realpath     (const char *file);
79    EAPI Eina_Bool   ecore_file_unlink       (const char *file);
80    EAPI Eina_Bool   ecore_file_remove       (const char *file);
81    EAPI const char *ecore_file_file_get     (const char *path);
82    EAPI char       *ecore_file_dir_get      (const char *path);
83
84    EAPI Eina_Bool   ecore_file_can_read     (const char *file);
85    EAPI Eina_Bool   ecore_file_can_write    (const char *file);
86    EAPI Eina_Bool   ecore_file_can_exec     (const char *file);
87    EAPI char       *ecore_file_readlink     (const char *link);
88    EAPI Eina_List  *ecore_file_ls           (const char *dir);
89    EAPI Eina_Iterator *ecore_file_ls_iterator(const char *dir);
90    EAPI char       *ecore_file_app_exe_get  (const char *app);
91    EAPI char       *ecore_file_escape_name  (const char *filename);
92    EAPI char       *ecore_file_strip_ext    (const char *file);
93    EAPI int         ecore_file_dir_is_empty (const char *dir);
94
95    EAPI Ecore_File_Monitor * ecore_file_monitor_add(const char *path,
96                 void (*func) (void *data, Ecore_File_Monitor *em,
97                       Ecore_File_Event event,
98                       const char *path),
99                 void *data);
100    EAPI void        ecore_file_monitor_del(Ecore_File_Monitor *ecore_file_monitor);
101    EAPI const char *ecore_file_monitor_path_get(Ecore_File_Monitor *ecore_file_monitor);
102
103    EAPI int         ecore_file_path_dir_exists(const char *in_dir);
104    EAPI int         ecore_file_app_installed(const char *exe);
105    EAPI Eina_List  *ecore_file_app_list(void);
106
107    EAPI int ecore_file_download(const char *url, const char *dst, 
108                                         void (*completion_cb)(void *data,
109                                                               const char *file,
110                                                               int status),
111                                         int (*progress_cb)(void *data,
112                                                            const char *file,
113                                                            long int dltotal,
114                                                            long int dlnow,
115                                                            long int ultotal,
116                                                            long int ulnow),
117                                         void *data, 
118                                         Ecore_File_Download_Job **job_ret);
119    EAPI void        ecore_file_download_abort_all(void);  
120    EAPI void        ecore_file_download_abort(Ecore_File_Download_Job *job);
121    EAPI int         ecore_file_download_protocol_available(const char *protocol);
122
123 #ifdef __cplusplus
124 }
125 #endif
126
127 #endif