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