Fix:Core:Correct layering of android surfaces
[navit-package] / navit / start_real.c
index e152294..44f8279 100644 (file)
@@ -22,6 +22,7 @@
 #include <glib.h>
 #include <getopt.h>
 #include "config.h"
+#include "config_.h"
 #include "version.h"
 #include "item.h"
 #include "coord.h"
@@ -35,6 +36,8 @@
 #include "xmlconfig.h"
 #include "file.h"
 #include "search.h"
+#include "start_real.h"
+#include "linguistics.h"
 #include "navit_nls.h"
 #include "atom.h"
 #ifdef HAVE_API_WIN32_CE
@@ -51,29 +54,13 @@ print_usage(void)
 }
 
 
-static gchar *
-get_home_directory(void)
-{
-       static gchar *homedir = NULL;
-
-       if (homedir) return homedir;
-       homedir = getenv("HOME");
-       if (!homedir)
-       {
-               dbg(0,"Could not find home directory. Using current directory as home directory.\n");
-               homedir = ".";
-       } else {
-               homedir=g_strdup(homedir);
-       }
-       return homedir;
-}
-
 int main_real(int argc, char **argv)
 {
        xmlerror *error = NULL;
        char *config_file = NULL;
        int opt;
        char *cp;
+       struct attr navit;
 
        GList *list = NULL, *li;
 
@@ -142,17 +129,17 @@ int main_real(int argc, char **argv)
     // if config file is explicitely given only look for it, otherwise try std paths
        if (config_file) list = g_list_append(list,g_strdup(config_file));
     else {
-               list = g_list_append(list,g_strjoin(NULL,get_home_directory(), "/.navit/navit.xml" , NULL));
+               list = g_list_append(list,g_strjoin(NULL,getenv("NAVIT_USER_DATADIR"), "/navit.xml" , NULL));
                list = g_list_append(list,g_strdup("navit.xml.local"));
                list = g_list_append(list,g_strdup("navit.xml"));
+#ifdef HAVE_API_ANDROID
+               list = g_list_append(list,g_strdup("/sdcard/navit.xml"));
+#endif
                list = g_list_append(list,g_strjoin(NULL,getenv("NAVIT_SHAREDIR"), "/navit.xml.local" , NULL));
                list = g_list_append(list,g_strjoin(NULL,getenv("NAVIT_SHAREDIR"), "/navit.xml" , NULL));
 #ifndef _WIN32
                list = g_list_append(list,g_strdup("/etc/navit/navit.xml"));
 #endif
-#ifdef HAVE_API_ANDROID
-               list = g_list_append(list,g_strdup("/sdcard/navit.xml"));
-#endif
        }
        li = list;
        for (;;) {
@@ -180,7 +167,7 @@ int main_real(int argc, char **argv)
                li = g_list_next(li);
        }
        g_list_free(list);
-       if (! main_get_navit(NULL)) {
+       if (! config_get_attr(config, attr_navit, &navit, NULL)) {
                dbg(0, _("No instance has been created, exiting\n"));
                exit(1);
        }