Ecore_File.h

Langue: en

Autres versions - même langue

Version: 375539 (fedora - 01/12/10)

Section: 3 (Bibliothèques de fonctions)

Sommaire

NAME

Ecore_File.h -

Files utility functions.

SYNOPSIS


Functions


EAPI int ecore_file_init (void)
Initialize Ecore_File and the services it will use.
EAPI int ecore_file_shutdown (void)
Shutdown the Ecore_File.
EAPI long long ecore_file_mod_time (const char *file)
Get the time of the last modification to the give file.
EAPI long long ecore_file_size (const char *file)
Get the size of the given file.
EAPI Eina_Bool ecore_file_exists (const char *file)
Check if file exists.
EAPI Eina_Bool ecore_file_is_dir (const char *file)
Check if file is a directory.
EAPI Eina_Bool ecore_file_mkdir (const char *dir)
Create a new directory.
EAPI int ecore_file_mkdirs (const char **dirs)
Create complete directory in a batch.
EAPI int ecore_file_mksubdirs (const char *base, const char **subdirs)
Create complete list of sub-directories in a batch (optimized).
EAPI Eina_Bool ecore_file_rmdir (const char *dir)
Delete the given dir.
EAPI Eina_Bool ecore_file_recursive_rm (const char *dir)
Delete a directory and all its contents.
EAPI Eina_Bool ecore_file_mkpath (const char *path)
Create a complete path.
EAPI int ecore_file_mkpaths (const char **paths)
Create complete paths in a batch.
EAPI Eina_Bool ecore_file_cp (const char *src, const char *dst)
Copy a file.
EAPI Eina_Bool ecore_file_mv (const char *src, const char *dst)
Move a file.
EAPI Eina_Bool ecore_file_symlink (const char *src, const char *dest)
Create a symbolic link.
EAPI char * ecore_file_realpath (const char *file)
Get the canonicalized absolute pathname.
EAPI Eina_Bool ecore_file_unlink (const char *file)
Delete the given file.
EAPI Eina_Bool ecore_file_remove (const char *file)
Remove the given file or directory.
EAPI const char * ecore_file_file_get (const char *path)
Get the filename from a give path.
EAPI char * ecore_file_dir_get (const char *path)
Get the directory where file reside.
EAPI Eina_Bool ecore_file_can_read (const char *file)
Check if file can be read.
EAPI Eina_Bool ecore_file_can_write (const char *file)
Check if file can be written.
EAPI Eina_Bool ecore_file_can_exec (const char *file)
Check if file can be executed.
EAPI char * ecore_file_readlink (const char *link)
Get the path pointed by link.
EAPI Eina_List * ecore_file_ls (const char *dir)
Get the list of the files and directories in a given directory.
EAPI char * ecore_file_app_exe_get (const char *app)
FIXME: To be documented.
EAPI char * ecore_file_escape_name (const char *filename)
Add the escape sequence ('\') to the given filename.
EAPI char * ecore_file_strip_ext (const char *file)
Remove the extension from a given path.
EAPI int ecore_file_dir_is_empty (const char *dir)
Check if the given directory is empty.
EAPI void ecore_file_monitor_del (Ecore_File_Monitor *ecore_file_monitor)
Stop monitoring a path.
EAPI const char * ecore_file_monitor_path_get (Ecore_File_Monitor *ecore_file_monitor)
Get the monitored path.
EAPI int ecore_file_path_dir_exists (const char *in_dir)
Check if the given directory is in PATH.
EAPI int ecore_file_app_installed (const char *exe)
Check if the given application is installed.
EAPI Eina_List * ecore_file_app_list (void)
Get a list of all the applications installed on the system.
EAPI int 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), void *data, Ecore_File_Download_Job **job_ret)
Download url to the given dst.
EAPI void ecore_file_download_abort (Ecore_File_Download_Job *job)
Abort the given download job and call the completion_cb function with a of 1 (error).
EAPI int ecore_file_download_protocol_available (const char *protocol)
Check if the given protocol is available.

Detailed Description

Files utility functions.

Function Documentation

EAPI int ecore_file_app_installed (const char * exe)

Check if the given application is installed. Parameters:

exe The name of the application

Returns:

1 if the exe is in PATH and is executable

This function check if the given name exist in PATH and is executable

References ecore_file_app_installed().

Referenced by ecore_file_app_installed().

EAPI Eina_List* ecore_file_app_list (void)

Get a list of all the applications installed on the system. Returns:

An Eina_List containing all the executable files in the system

References ecore_file_app_list().

Referenced by ecore_file_app_list().

EAPI Eina_Bool ecore_file_can_exec (const char * file)

Check if file can be executed. Parameters:

file The name of the file

Returns:

EINA_TRUE if the file can be executed, EINA_FALSE otherwise

EAPI Eina_Bool ecore_file_can_read (const char * file)

Check if file can be read. Parameters:

file The name of the file

Returns:

EINA_TRUE if the file is readable, EINA_FALSE otherwise

EAPI Eina_Bool ecore_file_can_write (const char * file)

Check if file can be written. Parameters:

file The name of the file

Returns:

EINA_TRUE if the file is writable, EINA_FALSE otherwise

EAPI Eina_Bool ecore_file_cp (const char * src, const char * dst)

Copy a file. Parameters:

src The name of the source file
dst The name of the destination file

Returns:

EINA_TRUE on success, EINA_FALSE on failure

EAPI char* ecore_file_dir_get (const char * file)

Get the directory where file reside. Parameters:

file The name of the file

Returns:

The directory name

EAPI int ecore_file_dir_is_empty (const char * dir)

Check if the given directory is empty. The '.' and '..' files will be ignored.

Parameters:

dir The name of the directory to check

Returns:

1 if directory is empty, 0 if it has at least one file or -1 in case of errors

EAPI int ecore_file_download (const char * url, const char * dst, void(*)(void *data, const char *file, int status) completion_cb, int(*)(void *data, const char *file, long int dltotal, long int dlnow, long int ultotal, long int ulnow) progress_cb, void * data, Ecore_File_Download_Job ** job_ret)

Download url to the given dst. Parameters:

url The complete url to download
dst The local file to save the downloaded to
completion_cb A callback called on download complete
progress_cb A callback called during the download operation
data User data passed to both callbacks
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.

Returns:

1 if the download start or 0 on failure

You must provide the full url, including 'http://', 'ftp://' or 'file://'.

 If dst already exist it will not be overwritten and the function will fail.

 Ecore must be compiled with CURL to download using http and ftp protocols.

 The status param in the completion_cb() will be 0 if the download goes well or 1 in case of failure. 

References ecore_file_download().

Referenced by ecore_file_download().

EAPI void ecore_file_download_abort (Ecore_File_Download_Job * job)

Abort the given download job and call the completion_cb function with a of 1 (error). Parameters:

job The download job to abort

References ecore_con_url_data_get(), ecore_con_url_destroy(), and ecore_file_download_abort().

Referenced by ecore_file_download_abort().

EAPI int ecore_file_download_protocol_available (const char * protocol)

Check if the given protocol is available. Parameters:

protocol The protocol to check

Returns:

1 if protocol is handled or 0 if not

protocol can be 'http://', 'ftp://' or 'file://'.

 Ecore must be compiled with CURL to handle http and ftp protocols. 

References ecore_file_download_protocol_available().

Referenced by ecore_file_download_protocol_available().

EAPI char* ecore_file_escape_name (const char * filename)

Add the escape sequence ('\') to the given filename. Parameters:

filename The file name

Returns:

The file name with special characters escaped; if the length of the resulting string is longer than PATH_MAX it will return NULL

EAPI Eina_Bool ecore_file_exists (const char * file)

Check if file exists. Parameters:

file The name of the file

Returns:

EINA_TRUE if file exists on local filesystem, EINA_FALSE otherwise

EAPI const char* ecore_file_file_get (const char * path)

Get the filename from a give path. Parameters:

path The complete path

Returns:

Only the file name

EAPI int ecore_file_init (void)

Initialize Ecore_File and the services it will use. Call this function once before you use any of the ecore file functions.

Returns:

Return the number howoften ecore_file_init() was call succesfully; 0 if it failed.

EAPI Eina_Bool ecore_file_is_dir (const char * file)

Check if file is a directory. Parameters:

file The name of the file

Returns:

EINA_TRUE if file exist and is a directory, EINA_FALSE otherwise

EAPI Eina_List* ecore_file_ls (const char * dir)

Get the list of the files and directories in a given directory. The list will be sorted with strcoll as compare function. That means that you may want to set the current locale for the category LC_COLLATE with setlocale(). For more information see the manual pages of strcoll and setlocale. The list will not contain the directory entries for '.' and '..'.

Parameters:

dir The name of the directory to list

Returns:

Return an Eina_List containing all the files in the directory; on failure it returns NULL.

EAPI Eina_Bool ecore_file_mkdir (const char * dir)

Create a new directory. Parameters:

dir The name of the directory to create

Returns:

EINA_TRUE on successfull creation, EINA_FALSE on failure

The directory is created with the mode: S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH

EAPI int ecore_file_mkdirs (const char ** dirs)

Create complete directory in a batch. Parameters:

dirs list of directories, null terminated.

Returns:

number of successfull directories created, -1 if dirs is NULL.

See also:

ecore_file_mkdir() and ecore_file_mkpaths()

EAPI Eina_Bool ecore_file_mkpath (const char * path)

Create a complete path. Parameters:

path The path to create

Returns:

EINA_TRUE on success, EINA_FALSE on failure

See also:

ecore_file_mkpaths() and ecore_file_mkdir()

EAPI int ecore_file_mkpaths (const char ** paths)

Create complete paths in a batch. Parameters:

paths list of paths, null terminated.

Returns:

number of successfull paths created, -1 if paths is NULL.

See also:

ecore_file_mkpath() and ecore_file_mkdirs()

EAPI int ecore_file_mksubdirs (const char * base, const char ** subdirs)

Create complete list of sub-directories in a batch (optimized). Parameters:

base the base directory to act on, will be created if does not exists.
subdirs list of directories, null terminated. These are created similarly to ecore_file_mkdir(), so same mode and whole path to that point must exists. So if creating base/a/b/c, provide subdirs with 'a', 'a/b' and 'a/b/c' in that order!

Returns:

number of successfull directories created, -1 if subdirs or base is NULL or invalid.

See also:

ecore_file_mkdir() and ecore_file_mkpaths()

EAPI long long ecore_file_mod_time (const char * file)

Get the time of the last modification to the give file. Parameters:

file The name of the file

Returns:

Return the time of the last data modification, if an error should occur it will return 0

EAPI void ecore_file_monitor_del (Ecore_File_Monitor * em)

Stop monitoring a path. Parameters:

em The Ecore_File_Monitor to stop

References ecore_file_monitor_del().

Referenced by ecore_file_monitor_del().

EAPI const char* ecore_file_monitor_path_get (Ecore_File_Monitor * em)

Get the monitored path. Parameters:

em The Ecore_File_Monitor to query

Returns:

The path that is monitored by em

References ecore_file_monitor_path_get().

Referenced by ecore_file_monitor_path_get().

EAPI Eina_Bool ecore_file_mv (const char * src, const char * dst)

Move a file. Parameters:

src The name of the source file
dst The name of the destination file

Returns:

EINA_TRUE on success, EINA_FALSE on failure

EAPI int ecore_file_path_dir_exists (const char * in_dir)

Check if the given directory is in PATH. Parameters:

The name of the directory to search in PATH

Returns:

1 if the directory exist in PATH, 0 otherwise

References ecore_file_path_dir_exists().

Referenced by ecore_file_path_dir_exists().

Get the path pointed by link. Parameters:

link The name of the link

Returns:

The path pointed by link or NULL

EAPI char* ecore_file_realpath (const char * file)

Get the canonicalized absolute pathname. Parameters:

file The file path

Returns:

The canonicalized absolute pathname; on failure it will return an empty string

EAPI Eina_Bool ecore_file_recursive_rm (const char * dir)

Delete a directory and all its contents. Parameters:

dir The name of the directory to delete

Returns:

EINA_TRUE on success, EINA_FALSE on failure

If dir is a link only the link is removed

EAPI Eina_Bool ecore_file_remove (const char * file)

Remove the given file or directory. Parameters:

file The name of the file or directory to delete

Returns:

EINA_TRUE on success, EINA_FALSE on failure

EAPI Eina_Bool ecore_file_rmdir (const char * dir)

Delete the given dir. Parameters:

dir The name of the directory to delete

Returns:

EINA_TRUE on success, EINA_FALSE on failure

EAPI int ecore_file_shutdown (void)

Shutdown the Ecore_File. Returns:

returns the number of libraries that still uses Ecore_File

EAPI long long ecore_file_size (const char * file)

Get the size of the given file. Parameters:

file The name of the file

Returns:

The size of the file in byte

EAPI char* ecore_file_strip_ext (const char * path)

Remove the extension from a given path. Parameters:

path The name of the file

Returns:

A newly allocated string with the extension stripped out or NULL on errors

Create a symbolic link. Parameters:

src The name of the file to link
dest The name of link

Returns:

EINA_TRUE on success, EINA_FALSE on failure

Delete the given file. Parameters:

file The name of the file to delete

Returns:

EINA_TRUE on success, EINA_FALSE on failure

Author

Generated automatically by Doxygen for Ecore from the source code.