rimmed pushed a commit to branch master.

http://git.enlightenment.org/tools/eflete.git/commit/?id=e06807318c481b3813a1cd79b8b87cb18cb7f163

commit e06807318c481b3813a1cd79b8b87cb18cb7f163
Author: Vyacheslav Reutskiy <v.reuts...@samsung.com>
Date:   Tue Oct 13 11:17:01 2015 +0300

    project_common: add the bool return type for exist_permission_check
    
    Really need to check the result of permission and exist checks.
    fix my early fail :(
    
    Change-Id: I5b21f528ae73ab55ced52e13490004be52aa13ba
---
 src/bin/ui/project_common.c      | 8 +++++---
 src/bin/ui/project_common.h      | 2 +-
 src/bin/ui/tab_home_import_edc.c | 7 ++++---
 src/bin/ui/tab_home_import_edj.c | 7 ++++---
 src/bin/ui/tab_home_new.c        | 7 ++++---
 5 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/src/bin/ui/project_common.c b/src/bin/ui/project_common.c
index 9b6ad15..2540b9c 100644
--- a/src/bin/ui/project_common.c
+++ b/src/bin/ui/project_common.c
@@ -19,7 +19,7 @@
 
 #include "main_window.h"
 
-void
+Eina_Bool
 exist_permission_check(const char *path, const char *name,
                        const char *title, const char *msg)
 {
@@ -34,19 +34,21 @@ exist_permission_check(const char *path, const char *name,
     * So need to check there is the folder "path/name" */
    buf = eina_strbuf_new();
    eina_strbuf_append_printf(buf, "%s/%s", path, name);
-   if (!ecore_file_exists(eina_strbuf_string_get(buf))) return;
+   if (!ecore_file_exists(eina_strbuf_string_get(buf))) return false;
    btn_res = popup_want_action(title, msg, NULL,
                                NULL, BTN_REPLACE | BTN_CANCEL, NULL, NULL);
-   if (btn_res == BTN_CANCEL) return;
+   if (btn_res == BTN_CANCEL) return false;
    if (!ecore_file_can_write(eina_strbuf_string_get(buf)))
      {
         buf_msg = eina_strbuf_new();
         eina_strbuf_append_printf(buf_msg, _("Haven't permision to overwrite 
'%s' in '%s'"), name, path);
         popup_want_action(title, eina_strbuf_string_get(buf_msg), NULL, NULL, 
BTN_OK, NULL, NULL);
         eina_strbuf_free(buf_msg);
+        return false;
      }
    ecore_file_recursive_rm(eina_strbuf_string_get(buf));
    eina_strbuf_free(buf);
+   return true;
 }
 
 Eina_Bool
diff --git a/src/bin/ui/project_common.h b/src/bin/ui/project_common.h
index 0c10e1b..c0d44a7 100644
--- a/src/bin/ui/project_common.h
+++ b/src/bin/ui/project_common.h
@@ -20,7 +20,7 @@
 #ifndef PROJECT_COMMON_H
 #define PROJECT_COMMON_H
 
-void
+Eina_Bool
 exist_permission_check(const char *path, const char *name, const char *title, 
const char *msg);
 
 Eina_Bool
diff --git a/src/bin/ui/tab_home_import_edc.c b/src/bin/ui/tab_home_import_edc.c
index bf7c688..74d4df8 100644
--- a/src/bin/ui/tab_home_import_edc.c
+++ b/src/bin/ui/tab_home_import_edc.c
@@ -428,9 +428,10 @@ _import(void *data __UNUSED__,
                             elm_entry_entry_get(tab_edc.name),
                             elm_entry_entry_get(tab_edc.path));
 
-   exist_permission_check(elm_entry_entry_get(tab_edc.path),
-                          elm_entry_entry_get(tab_edc.name),
-                          _("Import edc-file"), eina_strbuf_string_get(buf));
+   if (!exist_permission_check(elm_entry_entry_get(tab_edc.path),
+                               elm_entry_entry_get(tab_edc.name),
+                               _("Import edc-file"), 
eina_strbuf_string_get(buf)))
+     return;
    eina_strbuf_free(buf);
    ap.splash = splash_add(ap.win,
                           _setup_open_splash,
diff --git a/src/bin/ui/tab_home_import_edj.c b/src/bin/ui/tab_home_import_edj.c
index aecce7f..63e6d14 100644
--- a/src/bin/ui/tab_home_import_edj.c
+++ b/src/bin/ui/tab_home_import_edj.c
@@ -105,9 +105,10 @@ _import(void *data __UNUSED__,
                             elm_entry_entry_get(tab_edj.name),
                             elm_entry_entry_get(tab_edj.path));
 
-   exist_permission_check(elm_entry_entry_get(tab_edj.path),
-                          elm_entry_entry_get(tab_edj.name),
-                          _("Import edj-file"), eina_strbuf_string_get(buf));
+   if (!exist_permission_check(elm_entry_entry_get(tab_edj.path),
+                               elm_entry_entry_get(tab_edj.name),
+                               _("Import edj-file"), 
eina_strbuf_string_get(buf)))
+     return;
    eina_strbuf_free(buf);
    ap.splash = splash_add(ap.win,
                           _setup_open_splash,
diff --git a/src/bin/ui/tab_home_new.c b/src/bin/ui/tab_home_new.c
index 3dc74c5..2eb5a41 100644
--- a/src/bin/ui/tab_home_new.c
+++ b/src/bin/ui/tab_home_new.c
@@ -521,9 +521,10 @@ _on_create(void *data __UNUSED__,
                             elm_entry_entry_get(tab_new.name),
                             elm_entry_entry_get(tab_new.path));
 
-   exist_permission_check(elm_entry_entry_get(tab_new.path),
-                          elm_entry_entry_get(tab_new.name),
-                          _("New project"), eina_strbuf_string_get(buf));
+   if (!exist_permission_check(elm_entry_entry_get(tab_new.path),
+                               elm_entry_entry_get(tab_new.name),
+                               _("New project"), eina_strbuf_string_get(buf)))
+     return;
    eina_strbuf_free(buf);
    ap.splash = splash_add(ap.win,
                           _setup_open_splash,

-- 


Reply via email to