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_BUILD 17 # ifdef DLL_EXPORT 18 # define EAPI __declspec(dllexport) 19 # else 20 # define EAPI 21 # endif 22 # else 23 # define EAPI __declspec(dllimport) 24 # endif 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 36 37 /** 38 * @file Ecore_File.h 39 * @brief Files utility functions. 40 */ 41 42 #ifdef __cplusplus 43 extern "C" { 44 #endif 45 46 /** 47 * @defgroup Ecore_File_Group Ecore_File - Files and directories convenience functions 48 * @ingroup Ecore 49 * 50 * @{ 51 */ 52 53 /** 54 * @typedef Ecore_File_Monitor 55 * Abstract type used when monitoring a directory. 56 */ 57 typedef struct _Ecore_File_Monitor Ecore_File_Monitor; 58 59 /** 60 * @typedef Ecore_File_Download_Job 61 * Abstract type used when aborting a download. 62 */ 63 typedef struct _Ecore_File_Download_Job Ecore_File_Download_Job; 64 65 /** 66 * @typedef _Ecore_File_Event 67 * The event type returned when a file or directory is monitored. 68 */ 69 typedef enum _Ecore_File_Event 70 { 71 ECORE_FILE_EVENT_NONE, /**< No event. */ 72 ECORE_FILE_EVENT_CREATED_FILE, /**< Created file event. */ 73 ECORE_FILE_EVENT_CREATED_DIRECTORY, /**< Created directory event. */ 74 ECORE_FILE_EVENT_DELETED_FILE, /**< Deleted file event. */ 75 ECORE_FILE_EVENT_DELETED_DIRECTORY, /**< Deleted directory event. */ 76 ECORE_FILE_EVENT_DELETED_SELF, /**< Deleted monitored directory event. */ 77 ECORE_FILE_EVENT_MODIFIED, /**< Modified file or directory event. */ 78 ECORE_FILE_EVENT_CLOSED /**< Closed file event */ 79 } Ecore_File_Event; 80 81 /** 82 * @typedef Ecore_File_Monitor_Cb 83 * Callback type used when a monitored directory has changes. 84 */ 85 typedef void (*Ecore_File_Monitor_Cb)(void *data, Ecore_File_Monitor *em, Ecore_File_Event event, const char *path); 86 87 /** 88 * @typedef Ecore_File_Download_Completion_Cb 89 * Callback type used when a download is finished. 90 */ 91 typedef void (*Ecore_File_Download_Completion_Cb)(void *data, const char *file, int status); 92 93 /** 94 * @typedef _Ecore_File_Progress_Return 95 * What to do with the download as a return from the 96 * Ecore_File_Download_Progress_Cb function, if provided. 97 */ 98 typedef enum _Ecore_File_Progress_Return 99 { 100 ECORE_FILE_PROGRESS_CONTINUE = 0, /**< Continue the download. */ 101 ECORE_FILE_PROGRESS_ABORT = 1 /**< Abort the download. */ 102 } Ecore_File_Progress_Return; 103 104 /** 105 * @typedef Ecore_File_Download_Progress_Cb 106 * Callback type used while a download is in progress. 107 */ 108 typedef int (*Ecore_File_Download_Progress_Cb)(void *data, 109 const char *file, 110 long int dltotal, 111 long int dlnow, 112 long int ultotal, 113 long int ulnow); 114 115 /* File operations */ 116 117 /** 118 * @brief Initializes the Ecore_File library. 119 * 120 * @return @c 1 or greater on success, otherwise @c 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 */ 130 EAPI int ecore_file_init (void); 131 132 /** 133 * @brief Shuts down the Ecore_File library. 134 * 135 * @return @c 0 when the library is completely shut down, @c 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 */ 142 EAPI int ecore_file_shutdown (void); 143 144 /** 145 * @brief Gets 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 @c 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 */ 154 EAPI long long ecore_file_mod_time (const char *file); 155 156 /** 157 * @brief Gets 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 @c 0 on failure. 161 * 162 * This function returns the size of @p file in bytes. On failure, it 163 * returns 0. 164 */ 165 EAPI long long ecore_file_size (const char *file); 166 167 /** 168 * @brief Checks 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 */ 176 EAPI Eina_Bool ecore_file_exists (const char *file); 177 178 /** 179 * @brief Checks 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 */ 188 EAPI Eina_Bool ecore_file_is_dir (const char *file); 189 190 /** 191 * @brief Creates 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 unused on Windows). On success, it returns @c EINA_TRUE, 199 * @c EINA_FALSE otherwise. 200 */ 201 EAPI Eina_Bool ecore_file_mkdir (const char *dir); 202 203 /** 204 * @brief Creates 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 successfully created 214 * directories. 215 */ 216 EAPI int ecore_file_mkdirs (const char **dirs); 217 218 /** 219 * @brief Creates 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 The number of successful directories created, @c -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 successfully created directories. 235 */ 236 EAPI int ecore_file_mksubdirs (const char *base, const char **subdirs); 237 238 /** 239 * @brief Deletes the given empty 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 */ 247 EAPI Eina_Bool ecore_file_rmdir (const char *dir); 248 249 /** 250 * @brief Deletes 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 */ 259 EAPI Eina_Bool ecore_file_recursive_rm (const char *dir); 260 261 /** 262 * @brief Creates 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 */ 272 EAPI Eina_Bool ecore_file_mkpath (const char *path); 273 274 /** 275 * @brief Creates complete paths in a batch. 276 * 277 * @param paths list of paths, null terminated. 278 * @return The number of successful paths created, @c -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 successfully created directories. 286 */ 287 EAPI int ecore_file_mkpaths (const char **paths); 288 289 /** 290 * @brief Copies 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 */ 301 EAPI Eina_Bool ecore_file_cp (const char *src, const char *dst); 302 303 /** 304 * @brief Moves 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 */ 313 EAPI Eina_Bool ecore_file_mv (const char *src, const char *dst); 314 315 /** 316 * @brief Creates 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 creates the symbolic link @p dest of @p src. It returns 323 * @c EINA_TRUE on success, @c EINA_FALSE otherwise. 324 * 325 * @note On windows, this function always returns @c EINA_FALSE. 326 */ 327 EAPI Eina_Bool ecore_file_symlink (const char *src, const char *dest); 328 329 /** 330 * @brief Gets the canonicalized absolute path name. 331 * 332 * @param file The file path. 333 * @return The canonicalized absolute pathname or an empty string on 334 * failure. 335 * 336 * This function returns the absolute path name of @p file as a newly 337 * allocated string. If @p file is @c NULL, or on error, this function 338 * returns an empty string. Otherwise, it returns the absolute path 339 * name. When not needed anymore, the returned value must be freed. 340 */ 341 EAPI char *ecore_file_realpath (const char *file); 342 343 /** 344 * @brief Deletes the given file. 345 * 346 * @param file The name of the file to delete. 347 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise. 348 * 349 * This function deletes @p file. It returns @c EINA_TRUE on success, 350 * @c EINA_FALSE otherwise. 351 */ 352 EAPI Eina_Bool ecore_file_unlink (const char *file); 353 354 /** 355 * @brief Removes the given file or directory. 356 * 357 * @param file The name of the file or directory to delete. 358 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise. 359 * 360 * This function removes @p file. It returns @c EINA_TRUE on success, 361 * @c EINA_FALSE otherwise. 362 */ 363 EAPI Eina_Bool ecore_file_remove (const char *file); 364 365 /** 366 * @brief Gets the filename from a given path. 367 * 368 * @param path The complete path. 369 * @return The file name. 370 * 371 * This function returns the file name of @p path. If @p path is 372 * @c NULL, the functions returns @c NULL. 373 */ 374 EAPI const char *ecore_file_file_get (const char *path); 375 376 /** 377 * @brief Gets the directory where the given file resides. 378 * 379 * @param file The name of the file. 380 * @return The directory name. 381 * 382 * This function returns the directory where @p file resides as newly 383 * allocated string. If @p file is @c NULL or on error, this function 384 * returns @c NULL. When not needed anymore, the returned value must 385 * be freed. 386 */ 387 EAPI char *ecore_file_dir_get (const char *file); 388 389 /** 390 * @brief Checks if the given file can be read. 391 * 392 * @param file The name of the file. 393 * @return @c EINA_TRUE if the @p file is readable, @c EINA_FALSE otherwise. 394 * 395 * This function returns @c EINA_TRUE if @p file can be read, @c EINA_FALSE 396 * otherwise. 397 */ 398 EAPI Eina_Bool ecore_file_can_read (const char *file); 399 400 /** 401 * @brief Checks if the given file can be written. 402 * 403 * @param file The name of the file. 404 * @return @c EINA_TRUE if the @p file is writable, @c EINA_FALSE otherwise. 405 * 406 * This function returns @c EINA_TRUE if @p file can be written, @c EINA_FALSE 407 * otherwise. 408 */ 409 EAPI Eina_Bool ecore_file_can_write (const char *file); 410 411 /** 412 * @brief Checks if the given file can be executed. 413 * 414 * @param file The name of the file. 415 * @return @c EINA_TRUE if the @p file can be executed, @c EINA_FALSE 416 * otherwise. 417 * 418 * This function returns @c EINA_TRUE if @p file can be executed, @c EINA_FALSE 419 * otherwise. 420 */ 421 EAPI Eina_Bool ecore_file_can_exec (const char *file); 422 423 /** 424 * @brief Gets the path pointed by the given link. 425 * 426 * @param link The name of the link. 427 * @return The path pointed by link or NULL. 428 * 429 * This function returns the path pointed by @p link as a newly 430 * allocated string. On failure, the function returns @c NULL. When not 431 * needed anymore, the returned value must be freed. 432 * 433 * @note On windows, this function always returns @c NULL. 434 */ 435 EAPI char *ecore_file_readlink (const char *link); 436 437 /** 438 * @brief Gets the list of the files and directories in the given 439 * directory. 440 * 441 * @param dir The name of the directory to list 442 * @return Return an Eina_List containing all the files in the directory; 443 * on failure it returns NULL. 444 * 445 * This function returns a list of allocated strings of all the files 446 * and directories contained in @p dir. The list will be sorted with 447 * strcoll as compare function. That means that you may want to set 448 * the current locale for the category LC_COLLATE with 449 * setlocale(). For more information see the manual pages of strcoll 450 * and setlocale. The list will not contain the directory entries for 451 * '.' and '..'. On failure, @c NULL is returned. When not needed 452 * anymore, the list elements must be freed. 453 */ 454 EAPI Eina_List *ecore_file_ls (const char *dir); 455 456 /** 457 * @brief Returns the executable from the given command. 458 * 459 * @param app The application command, with parameters. 460 * @return The executable from @p app as a newly allocated string. Arguments 461 * are removed and escape characters are handled. If @p app is @c NULL, or 462 * on failure, the function returns @c NULL. When not needed anymore, the 463 * returned value must be freed. 464 */ 465 EAPI char *ecore_file_app_exe_get (const char *app); 466 467 /** 468 * @brief Adds the escape sequence ('\\') to the given file name. 469 * 470 * @param filename The file name. 471 * @return The file name with special characters escaped. 472 * 473 * This function adds the escape sequence ('\\') to the given file 474 * name and returns the result as a newly allocated string. If the 475 * length of the returned string is longer than PATH_MAX, or on 476 * failure, @c NULL is returned. When not needed anymore, the returned 477 * value must be freed. 478 */ 479 EAPI char *ecore_file_escape_name (const char *filename); 480 481 /** 482 * @brief Removes the extension from the given file name. 483 * 484 * @param path The name of the file. 485 * @return A newly allocated string with the extension stripped out, or 486 * @c NULL on errors. 487 * 488 * This function removes the extension from @p path and returns the 489 * result as a newly allocated string. If @p path is @c NULL, or on 490 * failure, the function returns @c NULL. When not needed anymore, the 491 * returned value must be freed. 492 */ 493 EAPI char *ecore_file_strip_ext (const char *path); 494 495 /** 496 * @brief Checks if the given directory is empty. 497 * 498 * @param dir The name of the directory to check. 499 * @return @c 1 if directory is empty, @c 0 if it has at least one file, or 500 * @c -1 in case of errors. 501 * 502 * This functions checks if @p dir is empty. The '.' and '..' files 503 * will be ignored. If @p dir is empty, 1 is returned, if it contains 504 * at least one file, @c 0 is returned. On failure, @c -1 is returned. 505 */ 506 EAPI int ecore_file_dir_is_empty (const char *dir); 507 508 /* Monitoring */ 509 510 /** 511 * @brief Monitors the given path using inotify, Windows notification, or polling. 512 * 513 * @param path The path to monitor. 514 * @param func The function to call on changes. 515 * @param data The data passed to func. 516 * @return An Ecore_File_Monitor pointer or NULL on failure. 517 * 518 * This function monitors @p path. If @p path is @c NULL, or is an 519 * empty string, or none of the notify methods (Inotify, Windows 520 * notification or polling) is available, or if @p path does not exist 521 * the function returns @c NULL. Otherwise, it returns a newly 522 * allocated Ecore_File_Monitor object and the monitoring begins. 523 * When one of the Ecore_File_Event event is notified, @p func is called 524 * and @p data is passed to @p func.Call ecore_file_monitor_del() to 525 * stop the monitoring. 526 */ 527 EAPI Ecore_File_Monitor *ecore_file_monitor_add(const char *path, 528 Ecore_File_Monitor_Cb func, 529 void *data); 530 531 /** 532 * @brief Stops the monitoring of the given path. 533 * 534 * @param em The Ecore_File_Monitor to stop. 535 * 536 * This function stops the the monitoring of the path that has been 537 * monitored by ecore_file_monitor_add(). @p em must be the value 538 * returned by ecore_file_monitor_add(). If @p em is @c NULL, or none 539 * of the notify methods (Inotify, Windows notification or polling) is 540 * available this function does nothing. 541 */ 542 EAPI void ecore_file_monitor_del(Ecore_File_Monitor *em); 543 544 /** 545 * @brief Gets the monitored path. 546 * 547 * @param em The Ecore_File_Monitor to query. 548 * @return The path that is monitored by @p em. 549 * 550 * This function returns the monitored path that has been 551 * monitored by ecore_file_monitor_add(). @p em must be the value 552 * returned by ecore_file_monitor_add(). If @p em is @c NULL, the 553 * function returns @c NULL. 554 */ 555 EAPI const char *ecore_file_monitor_path_get(Ecore_File_Monitor *em); 556 557 /* Path */ 558 559 /** 560 * @brief Checks if the given directory is in PATH. 561 * 562 * @param in_dir The name of the directory to search in PATH. 563 * @return @c EINA_TRUE if the directory exist in PATH, @c EINA_FALSE otherwise. 564 * 565 * This function checks if @p in_dir is in the environment variable 566 * PATH. If @p in_dir is @c NULL, or if PATH is empty, or @p in_dir is 567 * not in PATH, the function returns @c EINA_FALSE, otherwise it returns 568 * @c EINA_TRUE. 569 */ 570 EAPI Eina_Bool ecore_file_path_dir_exists(const char *in_dir); 571 572 /** 573 * @brief Checks if the given application is installed. 574 * 575 * @param exe The name of the application 576 * @return @c EINA_TRUE if the @p exe is in PATH and is executable, 577 * @c EINA_FALSE otherwise. 578 * 579 * This function checks if @p exe exists in PATH and is executable. If 580 * @p exe is @c NULL or is not executable, the function returns 581 * @c EINA_FALSE, otherwise it returns @c EINA_TRUE. 582 */ 583 EAPI Eina_Bool ecore_file_app_installed(const char *exe); 584 585 /** 586 * @brief Gets a list of all the applications installed on the system. 587 * 588 * @return An Eina_List containing all the executable files in the 589 * system. 590 * 591 * This function returns a list of allocated strings of all the 592 * executable files. If no files are found, the function returns 593 * @c NULL. When not needed anymore, the element of the list must be 594 * freed. 595 */ 596 EAPI Eina_List *ecore_file_app_list(void); 597 598 /* Download */ 599 600 /** 601 * @brief Downloads the given url to the given destination. 602 * 603 * @param url The complete url to download. 604 * @param dst The local file to save the downloaded to. 605 * @param completion_cb A callback called on download complete. 606 * @param progress_cb A callback called during the download operation. 607 * @param data User data passed to both callbacks. 608 * @param job_ret Job used to abort the download. 609 * @return @c EINA_TRUE if the download start or @c EINA_FALSE on failure. 610 * 611 * This function starts the download of the URL @p url and saves it to 612 * @p dst. @p url must provide the protocol, including '%http://', 613 * '%ftp://' or '%file://'. Ecore_File must be compiled with CURL to 614 * download using http and ftp protocols. If @p dst is ill-formed, or 615 * if it already exists, the function returns @c EINA_FALSE. When the 616 * download is complete, the callback @p completion_cb is called and 617 * @p data is passed to it. The @p status parameter of @p completion_cb 618 * will be filled with the status of the download (200, 404,...). The 619 * @p progress_cb is called during the download operation, each time a 620 * packet is received or when CURL wants. It can be used to display the 621 * percentage of the downloaded file. Return 0 from this callback, if provided, 622 * to continue the operation or anything else to abort the download. The only 623 * operations that can be aborted are those with protocol 'http' or 'ftp'. In 624 * that case @p job_ret can be passed to ecore_file_download_abort() to abort 625 * that download job. Similarly ecore_file_download_abort_all() can be used to 626 * abort all download operations. This function returns @c EINA_TRUE if the 627 * download starts, @c EINA_FALSE otherwise. 628 */ 629 EAPI Eina_Bool ecore_file_download(const char *url, 630 const char *dst, 631 Ecore_File_Download_Completion_Cb completion_cb, 632 Ecore_File_Download_Progress_Cb progress_cb, 633 void *data, 634 Ecore_File_Download_Job **job_ret); 635 636 /** 637 * @brief Downloads the given url to the given destination with additional headers. 638 * 639 * @param url The complete url to download. 640 * @param dst The local file to save the downloaded to. 641 * @param completion_cb A callback called on download complete. 642 * @param progress_cb A callback called during the download operation. 643 * @param data User data passed to both callbacks. 644 * @param job_ret Job used to abort the download. 645 * @param headers pointer of header lists. 646 * @return @c EINA_TRUE if the download start or @c EINA_FALSE on failure. 647 */ 648 EAPI Eina_Bool ecore_file_download_full(const char *url, 649 const char *dst, 650 Ecore_File_Download_Completion_Cb completion_cb, 651 Ecore_File_Download_Progress_Cb progress_cb, 652 void *data, 653 Ecore_File_Download_Job **job_ret, 654 Eina_Hash *headers); 655 656 /** 657 * @brief Aborts all downloads. 658 * 659 * This function aborts all the downloads that have been started by 660 * ecore_file_download(). It loops over the started downloads and call 661 * ecore_file_download_abort() for each of them. To abort only one 662 * specific download operation, call ecore_file_download_abort(). 663 */ 664 EAPI void ecore_file_download_abort_all(void); 665 666 /** 667 * @brief Aborts the given download job and call the completion_cb 668 * callback with a status of 1 (error). 669 * 670 * @param job The download job to abort. 671 * 672 * This function aborts a download operation started by 673 * ecore_file_download(). @p job is the #Ecore_File_Download_Job 674 * structure filled by ecore_file_download(). If it is @c NULL, this 675 * function does nothing. To abort all the currently downloading 676 * operations, call ecore_file_download_abort_all(). 677 */ 678 EAPI void ecore_file_download_abort(Ecore_File_Download_Job *job); 679 680 /** 681 * @brief Checks if the given protocol is available. 682 * 683 * @param protocol The protocol to check. 684 * @return @c EINA_TRUE if protocol is handled, @c EINA_FALSE otherwise. 685 * 686 * This function returns @c EINA_TRUE if @p protocol is supported, 687 * @c EINA_FALSE otherwise. @p protocol can be '%http://', '%ftp://' or 688 * '%file://'. Ecore_FILE must be compiled with CURL to handle http and 689 * ftp protocols. 690 */ 691 EAPI Eina_Bool ecore_file_download_protocol_available(const char *protocol); 692 693 /** 694 * @} 695 */ 696 697 #ifdef __cplusplus 698 } 699 #endif 700 701 #undef EAPI 702 #define EAPI 703 704 #endif 705