summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2015-05-27 14:32:03 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2015-05-27 14:32:24 +0100
commit742d7c394ca99587fbe01fb0da5fd744c7ffbaee (patch)
tree9d0f19b1b0b96acf05b16529de145bc08e5af1a7
parentcc49c1702b64152144a1fc6534ba9de71a61d4ba (diff)
eolian: allow a filename (rather than path) to be given to eolian_file_parse
-rw-r--r--src/lib/eolian/Eolian.h6
-rw-r--r--src/lib/eolian/eolian_database.c5
2 files changed, 10 insertions, 1 deletions
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
305/* 305/*
306 * @brief Parse the given .eo or .eot file and fill the database. 306 * @brief Parse the given .eo or .eot file and fill the database.
307 * 307 *
308 * The input can be either a full path to the file or only a filename.
309 * If it's a filename, it must be scanned for first.
310 *
308 * @param[in] filepath Path to the file to parse. 311 * @param[in] filepath Path to the file to parse.
312 * @return EINA_TRUE on success, EINA_FALSE on failure.
313 *
314 * @see eolian_directory_scan
309 * 315 *
310 * @ingroup Eolian 316 * @ingroup Eolian
311 */ 317 */
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
209eolian_file_parse(const char *filepath) 209eolian_file_parse(const char *filepath)
210{ 210{
211 Eina_Bool is_eo; 211 Eina_Bool is_eo;
212 const char *eopath;
212 if (_database_init_count <= 0) 213 if (_database_init_count <= 0)
213 return EINA_FALSE; 214 return EINA_FALSE;
214 is_eo = eina_str_has_suffix(filepath, EO_SUFFIX); 215 is_eo = eina_str_has_suffix(filepath, EO_SUFFIX);
@@ -217,7 +218,9 @@ eolian_file_parse(const char *filepath)
217 fprintf(stderr, "eolian: file '%s' doesn't have a correct extension\n", filepath); 218 fprintf(stderr, "eolian: file '%s' doesn't have a correct extension\n", filepath);
218 return EINA_FALSE; 219 return EINA_FALSE;
219 } 220 }
220 return eo_parser_database_fill(filepath, !is_eo); 221 if (!(eopath = eina_hash_find(is_eo ? _filenames : _tfilenames, filepath)))
222 eopath = filepath;
223 return eo_parser_database_fill(eopath, !is_eo);
221} 224}
222 225
223static Eina_Bool _tfile_parse(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata) 226static Eina_Bool _tfile_parse(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata)