yakov pushed a commit to branch master.

http://git.enlightenment.org/tools/erigo.git/commit/?id=6f42e88005c2f49f90c4661788062010eb3c1618

commit 6f42e88005c2f49f90c4661788062010eb3c1618
Author: Yakov Goldberg <yako...@samsung.com>
Date:   Wed Jan 28 15:06:49 2015 +0200

    Fix starting Erigo with 'erigo filename' when filename don't exist
---
 src/bin/egui_gui/egui_logic.c | 36 +++++++++++++++++++++++++++++++++---
 src/bin/main.c                |  2 +-
 2 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/src/bin/egui_gui/egui_logic.c b/src/bin/egui_gui/egui_logic.c
index c10aa67..bc17c8b 100644
--- a/src/bin/egui_gui/egui_logic.c
+++ b/src/bin/egui_gui/egui_logic.c
@@ -1010,11 +1010,41 @@ egui_stop()
 }
 
 void
-egui_project_open(char *filename)
+egui_project_open(char *path)
 {
-   if (filename)
+   if (path)
      {
-        if (_guilogic_cbs->_project_new(filename))
+        Eina_Bool post_open = EINA_FALSE;
+        /* If file exists try open it. */
+        if (ecore_file_exists(path))
+          {
+             if (_guilogic_cbs->_project_new(path))
+               {
+                  post_open = EINA_TRUE;
+               }
+          }
+        /* If not, create new file. */
+        else
+          {
+             if (_guilogic_cbs->_project_new(NULL))
+               {
+                  const Gui_Context *ctx = _active_context_get();
+
+                  char *_dir = ecore_file_dir_get(path);
+                  const char *filename = ecore_file_file_get(path);
+
+                  gui_context_project_name_set((Gui_Context *) ctx, filename);
+                  gui_context_project_path_set((Gui_Context *) ctx, _dir);
+                  gui_context_project_filename_set((Gui_Context *) ctx, 
filename);
+                  generator_ctx_source_generate(ctx, GENERATE_JSON);
+                  _canvas_name_update(ctx);
+
+                  free(_dir);
+                  post_open = EINA_TRUE;
+               }
+          }
+
+        if (post_open)
           {
              _canvas_name_update(_active_context_get());
              _menu_item_disabled_set(project_menu, ITEM_OPEN, EINA_TRUE);
diff --git a/src/bin/main.c b/src/bin/main.c
index ab72874..158eae2 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -227,7 +227,7 @@ main(int argc, char **argv)
                }
              if (!ecore_file_exists(dd))
                {
-                  printf("Path can not exist: \"%s\"\n", argv[optind]);
+                  printf("Path doesn't not exist: \"%s\"\n", argv[optind]);
                   goto end;
                }
              char *dd_realpath = ecore_file_realpath(dd);

-- 


Reply via email to