Memory File
[Tools]

Functions to traverse directories and split paths. More...


Defines

#define EINA_FILE_DIR_LIST_CB(function)   ((Eina_File_Dir_List_Cb)function)
 cast to an Eina_File_Dir_List_Cb.

Typedefs

typedef void(* Eina_File_Dir_List_Cb )(const char *name, const char *path, void *data)
 Type for a callback.

Functions

EAPI Eina_Bool eina_file_dir_list (const char *dir, Eina_Bool recursive, Eina_File_Dir_List_Cb cb, void *data)
 List all files on the directory calling the function for every file found.
EAPI Eina_Bool EAPI Eina_Arrayeina_file_split (char *path)
 Split a path according to the delimiter of the filesystem.


Detailed Description

Functions to traverse directories and split paths.

  • eina_file_dir_list() list the content of a directory, recusrsively or not, and can call a callback function for eachfound file.
  • eina_file_split() split a path into all the subdirectories that compose it, according to the separator of the file system.
Warning:
eina_file_split() uses the Array module but does not initialize it. eina_array_init() and eina_array_shutdown() must be called if this function is used.

Define Documentation

#define EINA_FILE_DIR_LIST_CB ( function   )     ((Eina_File_Dir_List_Cb)function)

cast to an Eina_File_Dir_List_Cb.

Parameters:
function The function to cast.
This macro casts function to Eina_File_Dir_List_Cb.


Function Documentation

EAPI Eina_Bool eina_file_dir_list ( const char *  dir,
Eina_Bool  recursive,
Eina_File_Dir_List_Cb  cb,
void *  data 
)

List all files on the directory calling the function for every file found.

Parameters:
dir The directory name.
recursive Iterate recursively in the directory.
cb The callback to be called.
data The data to pass to the callback.
Returns:
EINA_TRUE on success, EINA_FALSE oterwise.
This function lists all the files in dir. To list also all the sub directoris recursively, recursive must be set to EINA_TRUE, otherwise it must be set to EINA_FALSE. For each found file, cb is called and data is passed to it.

If cb or dir are NULL, or if dir is a string of size 0, or if dir can not be opened, this function returns EINA_FALSE immediatly. otherwise, it returns EINA_TRUE.

Referenced by eina_module_list_get().

EAPI Eina_Array * eina_file_split ( char *  path  ) 

Split a path according to the delimiter of the filesystem.

Parameters:
path The path to split.
Returns:
An array of the parts of the path to split.
This function splits path according to the delimiter of the used filesystem. If path is NULL or if the array can not be created, NULL is returned, otherwise, an array with the different parts of path is returned.

Warning:
This function uses the Array module but does not initialize it. eina_array_init() and eina_array_shutdown() must be called if this function is used.

References eina_array_new(), and eina_array_push().