parent
303edc4f9d
commit
d5f1ed5907
|
@ -105,13 +105,13 @@ EAPI const char *ecore_file_monitor_path_get(Ecore_File_Monitor *ecore_f
|
||||||
|
|
||||||
/* Path */
|
/* Path */
|
||||||
|
|
||||||
EAPI int ecore_file_path_dir_exists(const char *in_dir);
|
EAPI Eina_Bool ecore_file_path_dir_exists(const char *in_dir);
|
||||||
EAPI int ecore_file_app_installed(const char *exe);
|
EAPI Eina_Bool ecore_file_app_installed(const char *exe);
|
||||||
EAPI Eina_List *ecore_file_app_list(void);
|
EAPI Eina_List *ecore_file_app_list(void);
|
||||||
|
|
||||||
/* Download */
|
/* Download */
|
||||||
|
|
||||||
EAPI int ecore_file_download(const char *url,
|
EAPI Eina_Bool ecore_file_download(const char *url,
|
||||||
const char *dst,
|
const char *dst,
|
||||||
void (*completion_cb)(void *data,
|
void (*completion_cb)(void *data,
|
||||||
const char *file,
|
const char *file,
|
||||||
|
@ -126,7 +126,7 @@ EAPI int ecore_file_download(const char *url,
|
||||||
Ecore_File_Download_Job **job_ret);
|
Ecore_File_Download_Job **job_ret);
|
||||||
EAPI void ecore_file_download_abort_all(void);
|
EAPI void ecore_file_download_abort_all(void);
|
||||||
EAPI void ecore_file_download_abort(Ecore_File_Download_Job *job);
|
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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ ecore_file_download_abort_all(void)
|
||||||
* @param job_ret If the protocol in use is http or ftp, this parameter will be
|
* @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.
|
* 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
|
* 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
|
* If @p dst already exist it will not be overwritten and the function will fail.\n
|
||||||
|
@ -109,7 +109,7 @@ ecore_file_download_abort_all(void)
|
||||||
* The @p status param in the @p completion_cb() will be 0 if the download goes well or
|
* The @p status param in the @p completion_cb() will be 0 if the download goes well or
|
||||||
* 1 in case of failure.
|
* 1 in case of failure.
|
||||||
*/
|
*/
|
||||||
EAPI int
|
EAPI Eina_Bool
|
||||||
ecore_file_download(const char *url, const char *dst,
|
ecore_file_download(const char *url, const char *dst,
|
||||||
void (*completion_cb)(void *data, const char *file, int status),
|
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),
|
int (*progress_cb)(void *data, const char *file, long int dltotal, long int dlnow, long int ultotal, long int ulnow),
|
||||||
|
@ -121,10 +121,10 @@ ecore_file_download(const char *url, const char *dst,
|
||||||
if (!ecore_file_is_dir(dir))
|
if (!ecore_file_is_dir(dir))
|
||||||
{
|
{
|
||||||
free(dir);
|
free(dir);
|
||||||
return 0;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
free(dir);
|
free(dir);
|
||||||
if (ecore_file_exists(dst)) return 0;
|
if (ecore_file_exists(dst)) return EINA_FALSE;
|
||||||
|
|
||||||
/* FIXME: Add handlers for http and ftp! */
|
/* FIXME: Add handlers for http and ftp! */
|
||||||
if (!strncmp(url, "file://", 7))
|
if (!strncmp(url, "file://", 7))
|
||||||
|
@ -147,41 +147,41 @@ ecore_file_download(const char *url, const char *dst,
|
||||||
|
|
||||||
job = _ecore_file_download_curl(url, dst, completion_cb, progress_cb, data);
|
job = _ecore_file_download_curl(url, dst, completion_cb, progress_cb, data);
|
||||||
if(job_ret) *job_ret = job;
|
if(job_ret) *job_ret = job;
|
||||||
return !!job;
|
return job ? EINA_TRUE : EINA_FALSE;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return 0;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
completion_cb = NULL;
|
completion_cb = NULL;
|
||||||
progress_cb = NULL;
|
progress_cb = NULL;
|
||||||
data = NULL;
|
data = NULL;
|
||||||
return 0;
|
return EINA_FALSE;
|
||||||
#endif /* BUILD_ECORE_CON */
|
#endif /* BUILD_ECORE_CON */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the given protocol is available
|
* Check if the given protocol is available
|
||||||
* @param protocol The protocol to check
|
* @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
|
* @p protocol can be 'http://', 'ftp://' or 'file://'.\n
|
||||||
* Ecore must be compiled with CURL to handle http and ftp protocols.
|
* 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)
|
ecore_file_download_protocol_available(const char *protocol)
|
||||||
{
|
{
|
||||||
#ifdef BUILD_ECORE_CON
|
#ifdef BUILD_ECORE_CON
|
||||||
if (!strncmp(protocol, "file://", 7)) return 1;
|
if (!strncmp(protocol, "file://", 7)) return EINA_TRUE;
|
||||||
# ifdef HAVE_CURL
|
# ifdef HAVE_CURL
|
||||||
else if (!strncmp(protocol, "http://", 7)) return 1;
|
else if (!strncmp(protocol, "http://", 7)) return EINA_TRUE;
|
||||||
else if (!strncmp(protocol, "ftp://", 6)) return 1;
|
else if (!strncmp(protocol, "ftp://", 6)) return EINA_TRUE;
|
||||||
# endif
|
# endif
|
||||||
#endif /* BUILD_ECORE_CON */
|
#endif /* BUILD_ECORE_CON */
|
||||||
|
|
||||||
return 0;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BUILD_ECORE_CON
|
#ifdef BUILD_ECORE_CON
|
||||||
|
|
|
@ -60,49 +60,49 @@ _ecore_file_path_from_env(const char *env)
|
||||||
/**
|
/**
|
||||||
* Check if the given directory is in PATH
|
* Check if the given directory is in PATH
|
||||||
* @param The name of the directory to search 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)
|
ecore_file_path_dir_exists(const char *in_dir)
|
||||||
{
|
{
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
char *dir;
|
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)
|
EINA_LIST_FOREACH(__ecore_file_path_bin, l, dir)
|
||||||
{
|
{
|
||||||
if (strcmp(dir, in_dir))
|
if (strcmp(dir, in_dir))
|
||||||
return 1;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the given application is installed
|
* Check if the given application is installed
|
||||||
* @param exe The name of the application
|
* @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
|
* 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)
|
ecore_file_app_installed(const char *exe)
|
||||||
{
|
{
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
char *dir;
|
char *dir;
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
|
|
||||||
if (!exe) return 0;
|
if (!exe) return EINA_FALSE;
|
||||||
if (ecore_file_can_exec(exe)) return 1;
|
if (ecore_file_can_exec(exe)) return EINA_TRUE;
|
||||||
|
|
||||||
EINA_LIST_FOREACH(__ecore_file_path_bin, l, dir)
|
EINA_LIST_FOREACH(__ecore_file_path_bin, l, dir)
|
||||||
{
|
{
|
||||||
snprintf(buf, sizeof(buf), "%s/%s", dir, exe);
|
snprintf(buf, sizeof(buf), "%s/%s", dir, exe);
|
||||||
if (ecore_file_can_exec(buf))
|
if (ecore_file_can_exec(buf))
|
||||||
return 1;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue