code refactoring.

centralize divergent logics.
This commit is contained in:
Hermet Park 2016-08-24 17:21:21 +09:00
parent a709380b32
commit 6d5ce9daca
3 changed files with 17 additions and 11 deletions

View File

@ -5,6 +5,8 @@
#include <Enventor.h>
#include "enventor_private.h"
typedef struct builder_s
{
Eina_Strbuf *strbuf;
@ -146,22 +148,14 @@ build_edc(void)
char *cur_dir = ecore_file_realpath("./");
if (!cur_dir) goto err;
#ifdef _WIN32
if (_chdir(edc_dir)) goto err;
#else
if (chdir(edc_dir)) goto err;
#endif
if (change_cur_dir(edc_dir)) goto err;
Ecore_Exe_Flags flags =
(ECORE_EXE_PIPE_READ_LINE_BUFFERED | ECORE_EXE_PIPE_READ |
ECORE_EXE_PIPE_ERROR_LINE_BUFFERED | ECORE_EXE_PIPE_ERROR);
ecore_exe_pipe_run(bd->build_cmd, flags, NULL);
#ifdef _WIN32
if (_chdir(cur_dir)) goto err;
#else
if (chdir(cur_dir)) goto err;
#endif
if (change_cur_dir(cur_dir)) goto err;
err:
if (edc_dir) free(edc_dir);

View File

@ -310,6 +310,7 @@ Eina_List *edit_group_list_get(edit_data *ed);
/* util */
void mem_fail_msg(void);
const char* part_type_str_convert(Edje_Part_Type type);
int change_cur_dir(const char *dir);
/* reference */
void ref_init(void);

View File

@ -5,7 +5,18 @@
#include <Enventor.h>
#include "enventor_private.h"
void mem_fail_msg(void)
int
change_cur_dir(const char *dir)
{
#ifdef _WIN32
return _chdir(dir);
#else
return chdir(dir);
#endif
}
void
mem_fail_msg(void)
{
EINA_LOG_ERR("Failed to allocate Memory!");
}