From 742d7c394ca99587fbe01fb0da5fd744c7ffbaee Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Wed, 27 May 2015 14:32:03 +0100 Subject: [PATCH] eolian: allow a filename (rather than path) to be given to eolian_file_parse --- src/lib/eolian/Eolian.h | 6 ++++++ src/lib/eolian/eolian_database.c | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h index 0094ad0104..c10db83555 100644 --- a/src/lib/eolian/Eolian.h +++ b/src/lib/eolian/Eolian.h @@ -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 */ diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c index 94f6a9d1f1..31a6d869e1 100644 --- a/src/lib/eolian/eolian_database.c +++ b/src/lib/eolian/eolian_database.c @@ -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)