svn update: 48958 (latest:48959)
[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 /*
9  * TODO:
10  * - More events, move/rename of directory file
11  */
12
13 #include <Eina.h>
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    typedef struct _Ecore_File_Download_Job  Ecore_File_Download_Job;
53
54    typedef enum
55      {
56         ECORE_FILE_EVENT_NONE,
57           ECORE_FILE_EVENT_CREATED_FILE,
58           ECORE_FILE_EVENT_CREATED_DIRECTORY,
59           ECORE_FILE_EVENT_DELETED_FILE,
60           ECORE_FILE_EVENT_DELETED_DIRECTORY,
61           ECORE_FILE_EVENT_DELETED_SELF,
62           ECORE_FILE_EVENT_MODIFIED
63      } Ecore_File_Event;
64
65
66    EAPI int         ecore_file_init         (void);
67    EAPI int         ecore_file_shutdown     (void);
68    EAPI long long   ecore_file_mod_time     (const char *file);
69    EAPI long long   ecore_file_size         (const char *file);
70    EAPI int         ecore_file_exists       (const char *file);
71    EAPI int         ecore_file_is_dir       (const char *file);
72    EAPI int         ecore_file_mkdir        (const char *dir);
73    EAPI int         ecore_file_mkdirs       (const char **dirs);
74    EAPI int         ecore_file_mksubdirs    (const char *base, const char **subdirs);
75    EAPI int         ecore_file_rmdir        (const char *dir);
76    EAPI int         ecore_file_recursive_rm (const char *dir);
77    EAPI int         ecore_file_mkpath       (const char *path);
78    EAPI int         ecore_file_mkpaths      (const char **paths);
79    EAPI int         ecore_file_cp           (const char *src, const char *dst);
80    EAPI int         ecore_file_mv           (const char *src, const char *dst);
81    EAPI int         ecore_file_symlink      (const char *src, const char *dest);
82    EAPI char       *ecore_file_realpath     (const char *file);
83    EAPI int         ecore_file_unlink       (const char *file);
84    EAPI int         ecore_file_remove       (const char *file);
85    EAPI const char *ecore_file_file_get     (const char *path);
86    EAPI char       *ecore_file_dir_get      (const char *path);
87
88    EAPI int         ecore_file_can_read     (const char *file);
89    EAPI int         ecore_file_can_write    (const char *file);
90    EAPI int         ecore_file_can_exec     (const char *file);
91    EAPI char       *ecore_file_readlink     (const char *link);
92    EAPI Eina_List  *ecore_file_ls           (const char *dir);
93    EAPI char       *ecore_file_app_exe_get  (const char *app);
94    EAPI char       *ecore_file_escape_name  (const char *filename);
95    EAPI char       *ecore_file_strip_ext    (const char *file);
96    EAPI int         ecore_file_dir_is_empty (const char *dir);
97
98    EAPI Ecore_File_Monitor * ecore_file_monitor_add(const char *path,
99                 void (*func) (void *data, Ecore_File_Monitor *em,
100                       Ecore_File_Event event,
101                       const char *path),
102                 void *data);
103    EAPI void        ecore_file_monitor_del(Ecore_File_Monitor *ecore_file_monitor);
104    EAPI const char *ecore_file_monitor_path_get(Ecore_File_Monitor *ecore_file_monitor);
105
106    EAPI int         ecore_file_path_dir_exists(const char *in_dir);
107    EAPI int         ecore_file_app_installed(const char *exe);
108    EAPI Eina_List  *ecore_file_app_list(void);
109
110    EAPI int ecore_file_download(const char *url, const char *dst, 
111                                         void (*completion_cb)(void *data,
112                                                               const char *file,
113                                                               int status),
114                                         int (*progress_cb)(void *data,
115                                                            const char *file,
116                                                            long int dltotal,
117                                                            long int dlnow,
118                                                            long int ultotal,
119                                                            long int ulnow),
120                                         void *data, 
121                                         Ecore_File_Download_Job **job_ret);
122    EAPI void        ecore_file_download_abort_all(void);  
123    EAPI void        ecore_file_download_abort(Ecore_File_Download_Job *job);
124    EAPI int         ecore_file_download_protocol_available(const char *protocol);
125
126 #ifdef __cplusplus
127 }
128 #endif
129
130 #endif