diff options
author | Jee-Yong Um <conr2d@gmail.com> | 2016-10-04 21:08:17 +0900 |
---|---|---|
committer | Hermet Park <hermet@hermet.pe.kr> | 2016-10-04 21:08:17 +0900 |
commit | 3b4293ffa334303ccd2de0422d56a21873afcba0 (patch) | |
tree | 51ac1118cb56068bc74f2985120dcee688543ba9 /src/lib/ecore_file/Ecore_File.h | |
parent | 72125bd8c3e5e3d2d28d847c1a0ab4e02e3dccc8 (diff) |
ecore_file/ipc: clean up documentation
Summary: move comment from c source to header and adjust ingroup relationship
Reviewers: cedric, jpeg, Hermet
Reviewed By: Hermet
Differential Revision: https://phab.enlightenment.org/D4328
Diffstat (limited to 'src/lib/ecore_file/Ecore_File.h')
-rw-r--r-- | src/lib/ecore_file/Ecore_File.h | 509 |
1 files changed, 509 insertions, 0 deletions
diff --git a/src/lib/ecore_file/Ecore_File.h b/src/lib/ecore_file/Ecore_File.h index c78b0b1929..70c4af7b36 100644 --- a/src/lib/ecore_file/Ecore_File.h +++ b/src/lib/ecore_file/Ecore_File.h | |||
@@ -114,59 +114,535 @@ typedef int (*Ecore_File_Download_Progress_Cb)(void *data, | |||
114 | 114 | ||
115 | /* File operations */ | 115 | /* File operations */ |
116 | 116 | ||
117 | /** | ||
118 | * @brief Initialize the Ecore_File library. | ||
119 | * | ||
120 | * @return 1 or greater on success, 0 on error. | ||
121 | * | ||
122 | * This function sets up Ecore_File and the services it will use | ||
123 | * (monitoring, downloading, PATH related feature). It returns 0 on | ||
124 | * failure, otherwise it returns the number of times it has already | ||
125 | * been called. | ||
126 | * | ||
127 | * When Ecore_File is not used anymore, call ecore_file_shutdown() | ||
128 | * to shut down the Ecore_File library. | ||
129 | */ | ||
117 | EAPI int ecore_file_init (void); | 130 | EAPI int ecore_file_init (void); |
131 | |||
132 | /** | ||
133 | * @brief Shut down the Ecore_File library. | ||
134 | * | ||
135 | * @return 0 when the library is completely shut down, 1 or | ||
136 | * greater otherwise. | ||
137 | * | ||
138 | * This function shuts down the Ecore_File library. It returns 0 when it has | ||
139 | * been called the same number of times than ecore_file_init(). In that case | ||
140 | * it shuts down all the services it uses. | ||
141 | */ | ||
118 | EAPI int ecore_file_shutdown (void); | 142 | EAPI int ecore_file_shutdown (void); |
143 | |||
144 | /** | ||
145 | * @brief Get the time of the last modification to the given file. | ||
146 | * | ||
147 | * @param file The name of the file. | ||
148 | * @return Return the time of the last data modification, or 0 on | ||
149 | * failure. | ||
150 | * | ||
151 | * This function returns the time of the last modification of | ||
152 | * @p file. On failure, it returns 0. | ||
153 | */ | ||
119 | EAPI long long ecore_file_mod_time (const char *file); | 154 | EAPI long long ecore_file_mod_time (const char *file); |
155 | |||
156 | /** | ||
157 | * @brief Get the size of the given file. | ||
158 | * | ||
159 | * @param file The name of the file. | ||
160 | * @return Return the size of the file in bytes, or 0 on failure. | ||
161 | * | ||
162 | * This function returns the size of @p file in bytes. On failure, it | ||
163 | * returns 0. | ||
164 | */ | ||
120 | EAPI long long ecore_file_size (const char *file); | 165 | EAPI long long ecore_file_size (const char *file); |
166 | |||
167 | /** | ||
168 | * @brief Check if the given file exists. | ||
169 | * | ||
170 | * @param file The name of the file. | ||
171 | * @return @c EINA_TRUE if the @p file exists, @c EINA_FALSE otherwise. | ||
172 | * | ||
173 | * This function returns @c EINA_TRUE if @p file exists on local filesystem, | ||
174 | * @c EINA_FALSE otherwise. | ||
175 | */ | ||
121 | EAPI Eina_Bool ecore_file_exists (const char *file); | 176 | EAPI Eina_Bool ecore_file_exists (const char *file); |
177 | |||
178 | /** | ||
179 | * @brief Check if the given file is a directory. | ||
180 | * | ||
181 | * @param file The name of the file. | ||
182 | * @return @c EINA_TRUE if the file exists and is a directory, @c EINA_FALSE | ||
183 | * otherwise. | ||
184 | * | ||
185 | * This function returns @c EINA_TRUE if @p file exists exists and is a | ||
186 | * directory on local filesystem, @c EINA_FALSE otherwise. | ||
187 | */ | ||
122 | EAPI Eina_Bool ecore_file_is_dir (const char *file); | 188 | EAPI Eina_Bool ecore_file_is_dir (const char *file); |
189 | |||
190 | /** | ||
191 | * @brief Create a new directory. | ||
192 | * | ||
193 | * @param dir The name of the directory to create | ||
194 | * @return @c EINA_TRUE on successful creation, @c EINA_FALSE otherwise. | ||
195 | * | ||
196 | * This function creates the directory @p dir, with the mode S_IRUSR | | ||
197 | * S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH on UNIX | ||
198 | * (mode is unsued on Windows). On success, it returns @c EINA_TRUE, | ||
199 | * @c EINA_FALSE otherwise. | ||
200 | */ | ||
123 | EAPI Eina_Bool ecore_file_mkdir (const char *dir); | 201 | EAPI Eina_Bool ecore_file_mkdir (const char *dir); |
202 | |||
203 | /** | ||
204 | * @brief Create complete directory in a batch. | ||
205 | * | ||
206 | * @param dirs The list of directories, null terminated. | ||
207 | * @return The number of successful directories created, -1 if dirs is | ||
208 | * @c NULL. | ||
209 | * | ||
210 | * This function creates all the directories that are in the null | ||
211 | * terminated array @p dirs. The function loops over the directories | ||
212 | * and call ecore_file_mkdir(). This function returns -1 if @p dirs is | ||
213 | * @c NULL, otherwise if returns the number of suceesfully created | ||
214 | * directories. | ||
215 | */ | ||
124 | EAPI int ecore_file_mkdirs (const char **dirs); | 216 | EAPI int ecore_file_mkdirs (const char **dirs); |
217 | |||
218 | /** | ||
219 | * @brief Create complete list of sub-directories in a batch (optimized). | ||
220 | * | ||
221 | * @param base The base directory to act on. | ||
222 | * @param subdirs The list of directories, null terminated. | ||
223 | * @return number of successful directories created, -1 on failure. | ||
224 | * | ||
225 | * This function creates all the directories that are in the null | ||
226 | * terminated array @p subdirs in the @p base directory. If @p base does | ||
227 | * not exist, it will be created. The function loops over the directories | ||
228 | * and call ecore_file_mkdir(). The whole path of the directories must | ||
229 | * exist. So if base/a/b/c wants to be created, @p subdirs must | ||
230 | * contain "a", "a/b" and "a/b/c", in that order. This function | ||
231 | * returns -1 if @p subdirs or @p base are @c NULL, or if @p base is | ||
232 | * empty ("\0"). It returns 0 is @p base is not a directory or | ||
233 | * invalid, or if it can't be created. Otherwise if returns the number | ||
234 | * of suceesfully created directories. | ||
235 | */ | ||
125 | EAPI int ecore_file_mksubdirs (const char *base, const char **subdirs); | 236 | EAPI int ecore_file_mksubdirs (const char *base, const char **subdirs); |
237 | |||
238 | /** | ||
239 | * @brief Delete the given directory. | ||
240 | * | ||
241 | * @param dir The name of the directory to delete. | ||
242 | * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise. | ||
243 | * | ||
244 | * This function deletes @p dir. It returns @c EINA_TRUE on success, | ||
245 | * @c EINA_FALSE otherwise. | ||
246 | */ | ||
126 | EAPI Eina_Bool ecore_file_rmdir (const char *dir); | 247 | EAPI Eina_Bool ecore_file_rmdir (const char *dir); |
248 | |||
249 | /** | ||
250 | * @brief Delete the given directory and all its contents. | ||
251 | * | ||
252 | * @param dir The name of the directory to delete. | ||
253 | * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise. | ||
254 | * | ||
255 | * This function delete @p dir and all its contents. If @p dir is a | ||
256 | * link only the link is removed. It returns @c EINA_TRUE on success, | ||
257 | * @c EINA_FALSE otherwise. | ||
258 | */ | ||
127 | EAPI Eina_Bool ecore_file_recursive_rm (const char *dir); | 259 | EAPI Eina_Bool ecore_file_recursive_rm (const char *dir); |
260 | |||
261 | /** | ||
262 | * @brief Create a complete path. | ||
263 | * | ||
264 | * @param path The path to create | ||
265 | * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise. | ||
266 | * | ||
267 | * This function creates @p path and all the subdirectories it | ||
268 | * contains. The separator is '/' or '\'. If @p path exists, this | ||
269 | * function returns @c EINA_TRUE immediately. It returns @c EINA_TRUE on | ||
270 | * success, @c EINA_FALSE otherwise. | ||
271 | */ | ||
128 | EAPI Eina_Bool ecore_file_mkpath (const char *path); | 272 | EAPI Eina_Bool ecore_file_mkpath (const char *path); |
273 | |||
274 | /** | ||
275 | * @brief Create complete paths in a batch. | ||
276 | * | ||
277 | * @param paths list of paths, null terminated. | ||
278 | * @return number of successful paths created, -1 if paths is NULL. | ||
279 | * | ||
280 | * This function creates all the directories that are in the null | ||
281 | * terminated array @p paths. The function loops over the directories | ||
282 | * and call ecore_file_mkpath(), hence on Windows, '\' must be | ||
283 | * replaced by '/' before calling that function. This function | ||
284 | * returns -1 if @p paths is @c NULL. Otherwise if returns the number | ||
285 | * of suceesfully created directories. | ||
286 | */ | ||
129 | EAPI int ecore_file_mkpaths (const char **paths); | 287 | EAPI int ecore_file_mkpaths (const char **paths); |
288 | |||
289 | /** | ||
290 | * @brief Copy the given file to the given destination. | ||
291 | * | ||
292 | * @param src The name of the source file. | ||
293 | * @param dst The name of the destination file. | ||
294 | * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise. | ||
295 | * | ||
296 | * This function copies @p src to @p dst. If the absolute path name of | ||
297 | * @p src and @p dst can not be computed, or if they are equal, or if | ||
298 | * the copy fails, the function returns @c EINA_FALSE, otherwise it | ||
299 | * returns @c EINA_TRUE. | ||
300 | */ | ||
130 | EAPI Eina_Bool ecore_file_cp (const char *src, const char *dst); | 301 | EAPI Eina_Bool ecore_file_cp (const char *src, const char *dst); |
302 | |||
303 | /** | ||
304 | * @brief Move the given file to the given destination. | ||
305 | * | ||
306 | * @param src The name of the source file. | ||
307 | * @param dst The name of the destination file. | ||
308 | * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise. | ||
309 | * | ||
310 | * This function moves @p src to @p dst. It returns @c EINA_TRUE on | ||
311 | * success, @c EINA_FALSE otherwise. | ||
312 | */ | ||
131 | EAPI Eina_Bool ecore_file_mv (const char *src, const char *dst); | 313 | EAPI Eina_Bool ecore_file_mv (const char *src, const char *dst); |
314 | |||
315 | /** | ||
316 | * @brief Create a symbolic link. | ||
317 | * | ||
318 | * @param src The name of the file to link. | ||
319 | * @param dest The name of link. | ||
320 | * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise. | ||
321 | * | ||
322 | * This function create the symbolic link @p dest of @p src. This | ||
323 | * function does not work on Windows. It returns @c EINA_TRUE on success, | ||
324 | * @c EINA_FALSE otherwise. | ||
325 | */ | ||
132 | EAPI Eina_Bool ecore_file_symlink (const char *src, const char *dest); | 326 | EAPI Eina_Bool ecore_file_symlink (const char *src, const char *dest); |
327 | |||
328 | /** | ||
329 | * @brief Get the canonicalized absolute path name. | ||
330 | * | ||
331 | * @param file The file path. | ||
332 | * @return The canonicalized absolute pathname or an empty string on | ||
333 | * failure. | ||
334 | * | ||
335 | * This function returns the absolute path name of @p file as a newly | ||
336 | * allocated string. If @p file is @c NULL, or on error, this function | ||
337 | * returns an empty string. Otherwise, it returns the absolute path | ||
338 | * name. When not needed anymore, the returned value must be freed. | ||
339 | */ | ||
133 | EAPI char *ecore_file_realpath (const char *file); | 340 | EAPI char *ecore_file_realpath (const char *file); |
341 | |||
342 | /** | ||
343 | * @brief Delete the given file. | ||
344 | * | ||
345 | * @param file The name of the file to delete. | ||
346 | * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise. | ||
347 | * | ||
348 | * This function deletes @p file. It returns @c EINA_TRUE on success, | ||
349 | * @c EINA_FALSE otherwise. | ||
350 | */ | ||
134 | EAPI Eina_Bool ecore_file_unlink (const char *file); | 351 | EAPI Eina_Bool ecore_file_unlink (const char *file); |
352 | |||
353 | /** | ||
354 | * @brief Remove the given file or directory. | ||
355 | * | ||
356 | * @param file The name of the file or directory to delete. | ||
357 | * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise. | ||
358 | * | ||
359 | * This function removes @p file. It returns @c EINA_TRUE on success, | ||
360 | * @c EINA_FALSE otherwise. | ||
361 | */ | ||
135 | EAPI Eina_Bool ecore_file_remove (const char *file); | 362 | EAPI Eina_Bool ecore_file_remove (const char *file); |
363 | |||
364 | /** | ||
365 | * Get the filename from a given path. | ||
366 | * | ||
367 | * @param path The complete path. | ||
368 | * @return The file name. | ||
369 | * | ||
370 | * This function returns the file name of @p path. If @p path is | ||
371 | * @c NULL, the functions returns @c NULL. | ||
372 | */ | ||
136 | EAPI const char *ecore_file_file_get (const char *path); | 373 | EAPI const char *ecore_file_file_get (const char *path); |
374 | |||
375 | /** | ||
376 | * @brief Get the directory where the given file resides. | ||
377 | * | ||
378 | * @param file The name of the file. | ||
379 | * @return The directory name. | ||
380 | * | ||
381 | * This function returns the directory where @p file resides as anewly | ||
382 | * allocated string. If @p file is @c NULL or on error, this function | ||
383 | * returns @c NULL. When not needed anymore, the returned value must | ||
384 | * be freed. | ||
385 | */ | ||
137 | EAPI char *ecore_file_dir_get (const char *path); | 386 | EAPI char *ecore_file_dir_get (const char *path); |
387 | |||
388 | /** | ||
389 | * @brief Check if the given file can be read. | ||
390 | * | ||
391 | * @param file The name of the file. | ||
392 | * @return @c EINA_TRUE if the @p file is readable, @c EINA_FALSE otherwise. | ||
393 | * | ||
394 | * This function returns @c EINA_TRUE if @p file can be read, @c EINA_FALSE | ||
395 | * otherwise. | ||
396 | */ | ||
138 | EAPI Eina_Bool ecore_file_can_read (const char *file); | 397 | EAPI Eina_Bool ecore_file_can_read (const char *file); |
398 | |||
399 | /** | ||
400 | * @brief Check if the given file can be written. | ||
401 | * | ||
402 | * @param file The name of the file. | ||
403 | * @return @c EINA_TRUE if the @p file is writable, @c EINA_FALSE otherwise. | ||
404 | * | ||
405 | * This function returns @c EINA_TRUE if @p file can be written, @c EINA_FALSE | ||
406 | * otherwise. | ||
407 | */ | ||
139 | EAPI Eina_Bool ecore_file_can_write (const char *file); | 408 | EAPI Eina_Bool ecore_file_can_write (const char *file); |
409 | |||
410 | /** | ||
411 | * @brief Check if the given file can be executed. | ||
412 | * | ||
413 | * @param file The name of the file. | ||
414 | * @return @c EINA_TRUE if the @p file can be executed, @c EINA_FALSE | ||
415 | * otherwise. | ||
416 | * | ||
417 | * This function returns @c EINA_TRUE if @p file can be executed, @c EINA_FALSE | ||
418 | * otherwise. | ||
419 | */ | ||
140 | EAPI Eina_Bool ecore_file_can_exec (const char *file); | 420 | EAPI Eina_Bool ecore_file_can_exec (const char *file); |
421 | |||
422 | /** | ||
423 | * @brief Get the path pointed by the given link. | ||
424 | * | ||
425 | * @param lnk The name of the link. | ||
426 | * @return The path pointed by link or NULL. | ||
427 | * | ||
428 | * This function returns the path pointed by @p link as a newly | ||
429 | * allocated string. This function does not work on Windows. On | ||
430 | * failure, the function returns @c NULL. When not needed anymore, the | ||
431 | * returned value must be freed. | ||
432 | */ | ||
141 | EAPI char *ecore_file_readlink (const char *link); | 433 | EAPI char *ecore_file_readlink (const char *link); |
434 | |||
435 | /** | ||
436 | * @brief Get the list of the files and directories in the given | ||
437 | * directory. | ||
438 | * | ||
439 | * @param dir The name of the directory to list | ||
440 | * @return Return an Eina_List containing all the files in the directory; | ||
441 | * on failure it returns NULL. | ||
442 | * | ||
443 | * This function returns a list of allocated strings of all the files | ||
444 | * and directories contained in @p dir. The list will be sorted with | ||
445 | * strcoll as compare function. That means that you may want to set | ||
446 | * the current locale for the category LC_COLLATE with | ||
447 | * setlocale(). For more information see the manual pages of strcoll | ||
448 | * and setlocale. The list will not contain the directory entries for | ||
449 | * '.' and '..'. On failure, @c NULL is returned. When not needed | ||
450 | * anymore, the list elements must be freed. | ||
451 | */ | ||
142 | EAPI Eina_List *ecore_file_ls (const char *dir); | 452 | EAPI Eina_List *ecore_file_ls (const char *dir); |
453 | |||
454 | /** | ||
455 | * @brief Return the executable from the given command. | ||
456 | * | ||
457 | * @param app The application command, with parameters. | ||
458 | * @return The executable from @p app as a newly allocated string. Arguments | ||
459 | * are removed and escape characters are handled. If @p app is @c NULL, or | ||
460 | * on failure, the function returns @c NULL. When not needed anymore, the | ||
461 | * returned value must be freed. | ||
462 | */ | ||
143 | EAPI char *ecore_file_app_exe_get (const char *app); | 463 | EAPI char *ecore_file_app_exe_get (const char *app); |
464 | |||
465 | /** | ||
466 | * @brief Add the escape sequence ('\\') to the given file name. | ||
467 | * | ||
468 | * @param filename The file name. | ||
469 | * @return The file name with special characters escaped. | ||
470 | * | ||
471 | * This function adds the escape sequence ('\\') to the given file | ||
472 | * name and returns the result as a newly allocated string. If the | ||
473 | * length of the returned string is longer than PATH_MAX, or on | ||
474 | * failure, @c NULL is returned. When not needed anymore, the returned | ||
475 | * value must be freed. | ||
476 | */ | ||
144 | EAPI char *ecore_file_escape_name (const char *filename); | 477 | EAPI char *ecore_file_escape_name (const char *filename); |
478 | |||
479 | /** | ||
480 | * @brief Remove the extension from the given file name. | ||
481 | * | ||
482 | * @param path The name of the file. | ||
483 | * @return A newly allocated string with the extension stripped out or | ||
484 | * @c NULL on errors. | ||
485 | * | ||
486 | * This function removes the extension from @p path and returns the | ||
487 | * result as a newly allocated string. If @p path is @c NULL, or on | ||
488 | * failure, the function returns @c NULL. When not needed anymore, the | ||
489 | * returned value must be freed. | ||
490 | */ | ||
145 | EAPI char *ecore_file_strip_ext (const char *file); | 491 | EAPI char *ecore_file_strip_ext (const char *file); |
492 | |||
493 | /** | ||
494 | * @brief Check if the given directory is empty. | ||
495 | * | ||
496 | * @param dir The name of the directory to check. | ||
497 | * @return @c 1 if directory is empty, @c 0 if it has at least one file or | ||
498 | * @c -1 in case of errors. | ||
499 | * | ||
500 | * This functions checks if @p dir is empty. The '.' and '..' files | ||
501 | * will be ignored. If @p dir is empty, 1 is returned, if it contains | ||
502 | * at least one file, @c 0 is returned. On failure, @c -1 is returned. | ||
503 | */ | ||
146 | EAPI int ecore_file_dir_is_empty (const char *dir); | 504 | EAPI int ecore_file_dir_is_empty (const char *dir); |
147 | 505 | ||
148 | /* Monitoring */ | 506 | /* Monitoring */ |
149 | 507 | ||
508 | /** | ||
509 | * @brief Monitor the given path using inotify, Windows notification, or polling. | ||
510 | * | ||
511 | * @param path The path to monitor. | ||
512 | * @param func The function to call on changes. | ||
513 | * @param data The data passed to func. | ||
514 | * @return An Ecore_File_Monitor pointer or NULL on failure. | ||
515 | * | ||
516 | * This function monitors @p path. If @p path is @c NULL, or is an | ||
517 | * empty string, or none of the notify methods (Inotify, Windows | ||
518 | * notification or polling) is available, or if @p path does not exist | ||
519 | * the function returns @c NULL. Otherwise, it returns a newly | ||
520 | * allocated Ecore_File_Monitor object and the monitoring begins. | ||
521 | * When one of the Ecore_File_Event event is notified, @p func is called | ||
522 | * and @p data is passed to @p func.Call ecore_file_monitor_del() to | ||
523 | * stop the monitoring. | ||
524 | */ | ||
150 | EAPI Ecore_File_Monitor *ecore_file_monitor_add(const char *path, | 525 | EAPI Ecore_File_Monitor *ecore_file_monitor_add(const char *path, |
151 | Ecore_File_Monitor_Cb func, | 526 | Ecore_File_Monitor_Cb func, |
152 | void *data); | 527 | void *data); |
528 | |||
529 | /** | ||
530 | * @brief Stop the monitoring of the given path. | ||
531 | * | ||
532 | * @param em The Ecore_File_Monitor to stop. | ||
533 | * | ||
534 | * This function stops the the monitoring of the path that has been | ||
535 | * monitored by ecore_file_monitor_add(). @p em must be the value | ||
536 | * returned by ecore_file_monitor_add(). If @p em is @c NULL, or none | ||
537 | * of the notify methods (Inotify, Windows notification or polling) is | ||
538 | * availablethis function does nothing. | ||
539 | */ | ||
153 | EAPI void ecore_file_monitor_del(Ecore_File_Monitor *ecore_file_monitor); | 540 | EAPI void ecore_file_monitor_del(Ecore_File_Monitor *ecore_file_monitor); |
541 | |||
542 | /** | ||
543 | * @brief Get the monitored path. | ||
544 | * | ||
545 | * @param em The Ecore_File_Monitor to query. | ||
546 | * @return The path that is monitored by @p em. | ||
547 | * | ||
548 | * This function returns the monitored path that has been | ||
549 | * monitored by ecore_file_monitor_add(). @p em must be the value | ||
550 | * returned by ecore_file_monitor_add(). If @p em is @c NULL, the | ||
551 | * function returns @c NULL. | ||
552 | */ | ||
154 | EAPI const char *ecore_file_monitor_path_get(Ecore_File_Monitor *ecore_file_monitor); | 553 | EAPI const char *ecore_file_monitor_path_get(Ecore_File_Monitor *ecore_file_monitor); |
155 | 554 | ||
156 | /* Path */ | 555 | /* Path */ |
157 | 556 | ||
557 | /** | ||
558 | * @brief Check if the given directory is in PATH. | ||
559 | * | ||
560 | * @param in_dir The name of the directory to search in PATH. | ||
561 | * @return @c EINA_TRUE if the directory exist in PATH, @c EINA_FALSE otherwise. | ||
562 | * | ||
563 | * This function checks if @p in_dir is in the environment variable | ||
564 | * PATH. If @p in_dir is @c NULL, or if PATH is empty, or @p in_dir is | ||
565 | * not in PATH, the function returns @c EINA_FALSE, otherwise it returns | ||
566 | * @c EINA_TRUE. | ||
567 | */ | ||
158 | EAPI Eina_Bool ecore_file_path_dir_exists(const char *in_dir); | 568 | EAPI Eina_Bool ecore_file_path_dir_exists(const char *in_dir); |
569 | |||
570 | /** | ||
571 | * @brief Check if the given application is installed. | ||
572 | * | ||
573 | * @param exe The name of the application | ||
574 | * @return @c EINA_TRUE if the @p exe is in PATH and is executable, | ||
575 | * @c EINA_FALSE otherwise. | ||
576 | * | ||
577 | * This function checks if @p exe exists in PATH and is executable. If | ||
578 | * @p exe is @c NULL or is not executable, the function returns | ||
579 | * @c EINA_FALSE, otherwise it returns @c EINA_TRUE. | ||
580 | */ | ||
159 | EAPI Eina_Bool ecore_file_app_installed(const char *exe); | 581 | EAPI Eina_Bool ecore_file_app_installed(const char *exe); |
582 | |||
583 | /** | ||
584 | * @brief Get a list of all the applications installed on the system. | ||
585 | * | ||
586 | * @return An Eina_List containing all the executable files in the | ||
587 | * system. | ||
588 | * | ||
589 | * This function returns a list of allocated strings of all the | ||
590 | * executable files. If no files are found, the function returns | ||
591 | * @c NULL. When not needed anymore, the element of the list must be | ||
592 | * freed. | ||
593 | */ | ||
160 | EAPI Eina_List *ecore_file_app_list(void); | 594 | EAPI Eina_List *ecore_file_app_list(void); |
161 | 595 | ||
162 | /* Download */ | 596 | /* Download */ |
163 | 597 | ||
598 | /** | ||
599 | * @brief Download the given url to the given destination. | ||
600 | * | ||
601 | * @param url The complete url to download. | ||
602 | * @param dst The local file to save the downloaded to. | ||
603 | * @param completion_cb A callback called on download complete. | ||
604 | * @param progress_cb A callback called during the download operation. | ||
605 | * @param data User data passed to both callbacks. | ||
606 | * @param job_ret Job used to abort the download. | ||
607 | * @return @c EINA_TRUE if the download start or @c EINA_FALSE on failure. | ||
608 | * | ||
609 | * This function starts the download of the URL @p url and saves it to | ||
610 | * @p dst. @p url must provide the protocol, including 'http://', | ||
611 | * 'ftp://' or 'file://'. Ecore_File must be compiled with CURL to | ||
612 | * download using http and ftp protocols. If @p dst is ill-formed, or | ||
613 | * if it already exists, the function returns @c EINA_FALSE. When the | ||
614 | * download is complete, the callback @p completion_cb is called and | ||
615 | * @p data is passed to it. The @p status parameter of @p completion_cb | ||
616 | * will be filled with the status of the download (200, 404,...). The | ||
617 | * @p progress_cb is called during the download operation, each time a | ||
618 | * packet is received or when CURL wants. It can be used to display the | ||
619 | * percentage of the downloaded file. Return 0 from this callback, if provided, | ||
620 | * to continue the operation or anything else to abort the download. The only | ||
621 | * operations that can be aborted are those with protocol 'http' or 'ftp'. In | ||
622 | * that case @p job_ret can be passed to ecore_file_download_abort() to abort | ||
623 | * that download job. Similarly ecore_file_download_abort_all() can be used to | ||
624 | * abort all download operations. This function returns @c EINA_TRUE if the | ||
625 | * download starts, @c EINA_FALSE otherwise. | ||
626 | */ | ||
164 | EAPI Eina_Bool ecore_file_download(const char *url, | 627 | EAPI Eina_Bool ecore_file_download(const char *url, |
165 | const char *dst, | 628 | const char *dst, |
166 | Ecore_File_Download_Completion_Cb completion_cb, | 629 | Ecore_File_Download_Completion_Cb completion_cb, |
167 | Ecore_File_Download_Progress_Cb progress_cb, | 630 | Ecore_File_Download_Progress_Cb progress_cb, |
168 | void *data, | 631 | void *data, |
169 | Ecore_File_Download_Job **job_ret); | 632 | Ecore_File_Download_Job **job_ret); |
633 | |||
634 | /** | ||
635 | * @brief Download the given url to the given destination with additional headers. | ||
636 | * | ||
637 | * @param url The complete url to download. | ||
638 | * @param dst The local file to save the downloaded to. | ||
639 | * @param completion_cb A callback called on download complete. | ||
640 | * @param progress_cb A callback called during the download operation. | ||
641 | * @param data User data passed to both callbacks. | ||
642 | * @param job_ret Job used to abort the download. | ||
643 | * @param headers pointer of header lists. | ||
644 | * @return @c EINA_TRUE if the download start or @c EINA_FALSE on failure. | ||
645 | */ | ||
170 | EAPI Eina_Bool ecore_file_download_full(const char *url, | 646 | EAPI Eina_Bool ecore_file_download_full(const char *url, |
171 | const char *dst, | 647 | const char *dst, |
172 | Ecore_File_Download_Completion_Cb completion_cb, | 648 | Ecore_File_Download_Completion_Cb completion_cb, |
@@ -175,8 +651,41 @@ EAPI Eina_Bool ecore_file_download_full(const char *url, | |||
175 | Ecore_File_Download_Job **job_ret, | 651 | Ecore_File_Download_Job **job_ret, |
176 | Eina_Hash *headers); | 652 | Eina_Hash *headers); |
177 | 653 | ||
654 | /** | ||
655 | * @brief Abort all downloads. | ||
656 | * | ||
657 | * This function aborts all the downloads that have been started by | ||
658 | * ecore_file_download(). It loops over the started downloads and call | ||
659 | * ecore_file_download_abort() for each of them. To abort only one | ||
660 | * specific download operation, call ecore_file_download_abort(). | ||
661 | */ | ||
178 | EAPI void ecore_file_download_abort_all(void); | 662 | EAPI void ecore_file_download_abort_all(void); |
663 | |||
664 | /** | ||
665 | * @brief Abort the given download job and call the completion_cb | ||
666 | * callbck with a status of 1 (error). | ||
667 | * | ||
668 | * @param job The download job to abort. | ||
669 | * | ||
670 | * This function aborts a download operation started by | ||
671 | * ecore_file_download(). @p job is the #Ecore_File_Download_Job | ||
672 | * structure filled by ecore_file_download(). If it is @c NULL, this | ||
673 | * function does nothing. To abort all the currently downloading | ||
674 | * operations, call ecore_file_download_abort_all(). | ||
675 | */ | ||
179 | EAPI void ecore_file_download_abort(Ecore_File_Download_Job *job); | 676 | EAPI void ecore_file_download_abort(Ecore_File_Download_Job *job); |
677 | |||
678 | /** | ||
679 | * @brief Check if the given protocol is available. | ||
680 | * | ||
681 | * @param protocol The protocol to check. | ||
682 | * @return @c EINA_TRUE if protocol is handled, @c EINA_FALSE otherwise. | ||
683 | * | ||
684 | * This function returns @c EINA_TRUE if @p protocol is supported, | ||
685 | * @c EINA_FALSE otherwise. @p protocol can be 'http://', 'ftp://' or | ||
686 | * 'file://'. Ecore_FILE must be compiled with CURL to handle http and | ||
687 | * ftp protocols. | ||
688 | */ | ||
180 | EAPI Eina_Bool ecore_file_download_protocol_available(const char *protocol); | 689 | EAPI Eina_Bool ecore_file_download_protocol_available(const char *protocol); |
181 | 690 | ||
182 | /** | 691 | /** |