eolian: allow a filename (rather than path) to be given to eolian_file_parse

This commit is contained in:
Daniel Kolesa 2015-05-27 14:32:03 +01:00
parent cc49c1702b
commit 742d7c394c
2 changed files with 10 additions and 1 deletions

View File

@ -305,7 +305,13 @@ typedef enum
/*
* @brief Parse the given .eo or .eot file and fill the database.
*
* The input can be either a full path to the file or only a filename.
* If it's a filename, it must be scanned for first.
*
* @param[in] filepath Path to the file to parse.
* @return EINA_TRUE on success, EINA_FALSE on failure.
*
* @see eolian_directory_scan
*
* @ingroup Eolian
*/

View File

@ -209,6 +209,7 @@ EAPI Eina_Bool
eolian_file_parse(const char *filepath)
{
Eina_Bool is_eo;
const char *eopath;
if (_database_init_count <= 0)
return EINA_FALSE;
is_eo = eina_str_has_suffix(filepath, EO_SUFFIX);
@ -217,7 +218,9 @@ eolian_file_parse(const char *filepath)
fprintf(stderr, "eolian: file '%s' doesn't have a correct extension\n", filepath);
return EINA_FALSE;
}
return eo_parser_database_fill(filepath, !is_eo);
if (!(eopath = eina_hash_find(is_eo ? _filenames : _tfilenames, filepath)))
eopath = filepath;
return eo_parser_database_fill(eopath, !is_eo);
}
static Eina_Bool _tfile_parse(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata)