eolian: allow a filename (rather than path) to be given to eolian_file_parse
authorDaniel Kolesa <d.kolesa@osg.samsung.com>
Wed, 27 May 2015 13:32:03 +0000 (14:32 +0100)
committerDaniel Kolesa <d.kolesa@osg.samsung.com>
Wed, 27 May 2015 13:32:24 +0000 (14:32 +0100)
src/lib/eolian/Eolian.h
src/lib/eolian/eolian_database.c

index 0094ad0..c10db83 100644 (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
  */
index 94f6a9d..31a6d86 100644 (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)