make elm robust and handle if u DONT set compile time dirs.. and work
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 29 Mar 2012 12:00:14 +0000 (12:00 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 29 Mar 2012 12:00:14 +0000 (12:00 +0000)
anyway.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@69750 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/examples/image_example_01.c
src/lib/elm_main.c

index 0b358d8..c6b1665 100644 (file)
@@ -10,6 +10,7 @@ elm_main(int argc, char **argv)
    Evas_Object *win, *bg, *image;
    char buf[PATH_MAX];
 
+   elm_app_info_set(elm_main, "elementary", "images/plant_01.jpg");
    win = elm_win_add(NULL, "image", ELM_WIN_BASIC);
    elm_win_title_set(win, "Image");
    elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
@@ -21,7 +22,7 @@ elm_main(int argc, char **argv)
    elm_win_resize_object_add(win, bg);
    evas_object_show(bg);
 
-   snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", DATA_DIR);
+   snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
 
    image = elm_image_add(win);
    if (!elm_image_file_set(image, buf, NULL))
index 1536512..a1ab345 100644 (file)
@@ -107,6 +107,7 @@ _prefix_check(void)
    char **argv = NULL;
    const char *dirs[4] = { NULL, NULL, NULL, NULL };
    char *caps = NULL, *p1, *p2;
+   char buf[PATH_MAX];
 
    if (app_pfx) return;
    if (!app_domain) return;
@@ -118,11 +119,15 @@ _prefix_check(void)
    dirs[1] = app_compile_lib_dir;
    dirs[2] = app_compile_data_dir;
    dirs[3] = app_compile_locale_dir;
-
-   if (!dirs[1]) dirs[1] = dirs[0];
-   if (!dirs[0]) dirs[0] = dirs[1];
+   
+   if (!dirs[0]) dirs[0] = "/usr/local/bin";
+   if (!dirs[1]) dirs[1] = "/usr/local/lib";
+   if (!dirs[2])
+     {
+        snprintf(buf, sizeof(buf), "/usr/local/share/%s", app_domain);
+        dirs[2] = buf;
+     }
    if (!dirs[3]) dirs[3] = dirs[2];
-   if (!dirs[2]) dirs[2] = dirs[3];
 
    if (app_domain)
      {