summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@samsung.com>2014-03-03 18:00:45 +0200
committerDaniel Zaoui <daniel.zaoui@samsung.com>2014-03-03 18:14:14 +0200
commit49822ec28d7901676135c42bc63e8adb09294842 (patch)
tree0496052f036af2fc4919c1b6d38c5f8d28c0b81c /src/bin
parent1904466ebc1f649fdc9e00c9d16dde8a1b3165ea (diff)
Eolian: remove Ecore_File dependency
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/eolian/main.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c
index 6fe3e9d705..4a294e4281 100644
--- a/src/bin/eolian/main.c
+++ b/src/bin/eolian/main.c
@@ -1,7 +1,6 @@
1#include <getopt.h> 1#include <getopt.h>
2 2
3#include <Eina.h> 3#include <Eina.h>
4#include <Ecore_File.h>
5 4
6#include "Eolian.h" 5#include "Eolian.h"
7#include "legacy_generator.h" 6#include "legacy_generator.h"
@@ -31,6 +30,17 @@ _include_guard_enclose(const char *fname, const char *fbody)
31 return eina_strbuf_string_steal(incguard); 30 return eina_strbuf_string_steal(incguard);
32} 31}
33 32
33static const char *
34_filename_get(const char *path)
35{
36 char *result = NULL;
37
38 if (!path) return NULL;
39 if ((result = strrchr(path, '/'))) result++;
40 else result = (char *)path;
41 return result;
42}
43
34static Eina_Bool 44static Eina_Bool
35_generate_h_file(char *filename, const char *classname, Eina_Bool append) 45_generate_h_file(char *filename, const char *classname, Eina_Bool append)
36{ 46{
@@ -74,7 +84,7 @@ _generate_h_file(char *filename, const char *classname, Eina_Bool append)
74 84
75 if (htext) 85 if (htext)
76 { 86 {
77 char *fcontent = _include_guard_enclose(ecore_file_file_get(filename), htext); 87 char *fcontent = _include_guard_enclose(_filename_get(filename), htext);
78 fputs(fcontent, fd); 88 fputs(fcontent, fd);
79 free(fcontent); 89 free(fcontent);
80 } 90 }
@@ -161,7 +171,7 @@ _generate_legacy_header_file(char *filename, const char *classname, Eina_Bool ap
161 171
162 if (ltext) 172 if (ltext)
163 { 173 {
164 char *fcontent = _include_guard_enclose(ecore_file_file_get(filename), ltext); 174 char *fcontent = _include_guard_enclose(_filename_get(filename), ltext);
165 fputs(fcontent, fd); 175 fputs(fcontent, fd);
166 free(fcontent); 176 free(fcontent);
167 } 177 }
@@ -276,25 +286,19 @@ int main(int argc, char **argv)
276 case 'I': 286 case 'I':
277 { 287 {
278 const char *dir = optarg; 288 const char *dir = optarg;
279 if (ecore_file_is_dir(dir)) 289 Eina_Iterator *dir_files;
290 char *file;
291 /* Get all files from directory. Not recursively!!! */
292 dir_files = eina_file_ls(dir);
293 EINA_ITERATOR_FOREACH(dir_files, file)
280 { 294 {
281 Eina_List *dir_files; 295 if (eina_str_has_suffix(file, EO_SUFFIX))
282 char *file;
283 /* Get all files from directory. Not recursively!!!*/
284 dir_files = ecore_file_ls(dir);
285 EINA_LIST_FREE(dir_files, file)
286 { 296 {
287 char *filepath = malloc(strlen(dir) + 1 + strlen(file) + 1); 297 /* Allocated string will be freed during deletion of "included_files" list. */
288 sprintf(filepath, "%s/%s", dir, file); 298 included_files = eina_list_append(included_files, strdup(file));
289 if ((!ecore_file_is_dir(filepath)) && eina_str_has_suffix(filepath, EO_SUFFIX))
290 {
291 /* Allocated string will be freed during deletion of "included_files" list. */
292 included_files = eina_list_append(included_files, strdup(filepath));
293 }
294 free(filepath);
295 free(file);
296 } 299 }
297 } 300 }
301 eina_iterator_free(dir_files);
298 break; 302 break;
299 } 303 }
300 default: help = EINA_TRUE; 304 default: help = EINA_TRUE;