/* Path */
-EAPI int ecore_file_path_dir_exists(const char *in_dir);
-EAPI int ecore_file_app_installed(const char *exe);
+EAPI Eina_Bool ecore_file_path_dir_exists(const char *in_dir);
+EAPI Eina_Bool ecore_file_app_installed(const char *exe);
EAPI Eina_List *ecore_file_app_list(void);
/* Download */
-EAPI int ecore_file_download(const char *url,
+EAPI Eina_Bool ecore_file_download(const char *url,
const char *dst,
void (*completion_cb)(void *data,
const char *file,
Ecore_File_Download_Job **job_ret);
EAPI void ecore_file_download_abort_all(void);
EAPI void ecore_file_download_abort(Ecore_File_Download_Job *job);
-EAPI int ecore_file_download_protocol_available(const char *protocol);
+EAPI Eina_Bool ecore_file_download_protocol_available(const char *protocol);
#ifdef __cplusplus
}
* @param job_ret If the protocol in use is http or ftp, this parameter will be
* filled with the job. Then you can use ecore_file_download_abort() to cancel it.
*
- * @return 1 if the download start or 0 on failure
+ * @return EINA_TRUE if the download start or EINA_FALSE on failure
*
* You must provide the full url, including 'http://', 'ftp://' or 'file://'.\n
* If @p dst already exist it will not be overwritten and the function will fail.\n
* The @p status param in the @p completion_cb() will be 0 if the download goes well or
* 1 in case of failure.
*/
-EAPI int
+EAPI Eina_Bool
ecore_file_download(const char *url, const char *dst,
void (*completion_cb)(void *data, const char *file, int status),
int (*progress_cb)(void *data, const char *file, long int dltotal, long int dlnow, long int ultotal, long int ulnow),
if (!ecore_file_is_dir(dir))
{
free(dir);
- return 0;
+ return EINA_FALSE;
}
free(dir);
- if (ecore_file_exists(dst)) return 0;
+ if (ecore_file_exists(dst)) return EINA_FALSE;
/* FIXME: Add handlers for http and ftp! */
if (!strncmp(url, "file://", 7))
job = _ecore_file_download_curl(url, dst, completion_cb, progress_cb, data);
if(job_ret) *job_ret = job;
- return !!job;
+ return job ? EINA_TRUE : EINA_FALSE;
}
# endif
else
{
- return 0;
+ return EINA_FALSE;
}
#else
completion_cb = NULL;
progress_cb = NULL;
data = NULL;
- return 0;
+ return EINA_FALSE;
#endif /* BUILD_ECORE_CON */
}
/**
* Check if the given protocol is available
* @param protocol The protocol to check
- * @return 1 if protocol is handled or 0 if not
+ * @return EINA_TRUE if protocol is handled, EINA_FALSE otherwise
*
* @p protocol can be 'http://', 'ftp://' or 'file://'.\n
* Ecore must be compiled with CURL to handle http and ftp protocols.
*/
-EAPI int
+EAPI Eina_Bool
ecore_file_download_protocol_available(const char *protocol)
{
#ifdef BUILD_ECORE_CON
- if (!strncmp(protocol, "file://", 7)) return 1;
+ if (!strncmp(protocol, "file://", 7)) return EINA_TRUE;
# ifdef HAVE_CURL
- else if (!strncmp(protocol, "http://", 7)) return 1;
- else if (!strncmp(protocol, "ftp://", 6)) return 1;
+ else if (!strncmp(protocol, "http://", 7)) return EINA_TRUE;
+ else if (!strncmp(protocol, "ftp://", 6)) return EINA_TRUE;
# endif
#endif /* BUILD_ECORE_CON */
- return 0;
+ return EINA_FALSE;
}
#ifdef BUILD_ECORE_CON
/**
* Check if the given directory is in PATH
* @param The name of the directory to search in PATH
- * @return 1 if the directory exist in PATH, 0 otherwise
+ * @return EINA_TRUE if the directory exist in PATH, EINA_FALSE otherwise
*/
-EAPI int
+EAPI Eina_Bool
ecore_file_path_dir_exists(const char *in_dir)
{
Eina_List *l;
char *dir;
- if (!__ecore_file_path_bin) return 0;
+ if (!__ecore_file_path_bin) return EINA_FALSE;
EINA_LIST_FOREACH(__ecore_file_path_bin, l, dir)
{
if (strcmp(dir, in_dir))
- return 1;
+ return EINA_TRUE;
}
- return 0;
+ return EINA_FALSE;
}
/**
* Check if the given application is installed
* @param exe The name of the application
- * @return 1 if the exe is in PATH and is executable
+ * @return EINA_TRUE if the exe is in PATH and is executable, EINA_FALSE otherwise
*
* This function check if the given name exist in PATH and is executable
*/
-EAPI int
+EAPI Eina_Bool
ecore_file_app_installed(const char *exe)
{
Eina_List *l;
char *dir;
char buf[PATH_MAX];
- if (!exe) return 0;
- if (ecore_file_can_exec(exe)) return 1;
+ if (!exe) return EINA_FALSE;
+ if (ecore_file_can_exec(exe)) return EINA_TRUE;
EINA_LIST_FOREACH(__ecore_file_path_bin, l, dir)
{
snprintf(buf, sizeof(buf), "%s/%s", dir, exe);
if (ecore_file_can_exec(buf))
- return 1;
+ return EINA_TRUE;
}
- return 0;
+ return EINA_FALSE;
}
/**