summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel AINS <lains@caramail.com>2019-04-29 22:30:36 +0200
committerLionel AINS <lains@caramail.com>2019-04-29 22:30:36 +0200
commit01672c772e9f477b00a841f56635f2dbcc034399 (patch)
tree3a4b3b86330bab1f960f5286a73c8bed8802ed27
parent503d1c3ef81176882c6b17280cc6aabb8d545875 (diff)
downloadnavit-PR_758.tar.gz
Using HAVE_API_WIN32 instead of HAVE_API_WIN32_BASE (Both WinCE and Win32 have HAVE_API_WIN32_BASE defined)PR_758
-rw-r--r--navit/main.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/navit/main.c b/navit/main.c
index 053070c51..9fe77a334 100644
--- a/navit/main.c
+++ b/navit/main.c
@@ -114,7 +114,7 @@ static void main_setup_environment(int mode) {
val=g_strdup_printf("%s%s", getenv("NAVIT_PREFIX"), val+1);
break;
case '~':
-#ifdef HAVE_API_WIN32_BASE && !HAVE_API_WIN32_CE
+#if defined(HAVE_API_WIN32) && !defined(HAVE_API_WIN32_CE) // For Windows only, excluding WinCE
homedir=getenv("USERPROFILE");
#else
homedir=getenv("HOME");
@@ -132,7 +132,7 @@ static void main_setup_environment(int mode) {
}
i++;
}
-#ifdef HAVE_API_WIN32_BASE && !HAVE_API_WIN32_CE
+#if defined(HAVE_API_WIN32) && !defined(HAVE_API_WIN32_CE) // For Windows only, excluding WinCE
navit_get_user_data_directory(1); /* Create the user data directory */
#endif
}
@@ -383,11 +383,11 @@ void main_init(const char *program) {
} else
setenv("NAVIT_PREFIX", PREFIX, 0);
}
-#ifdef HAVE_API_ANDROID
+# ifdef HAVE_API_ANDROID
main_setup_environment(3);
-#else
+# else
main_setup_environment(1);
-#endif
+# endif
}
#else /* _WIN32 || _WIN32_WCE */
@@ -397,12 +397,12 @@ void main_init(const char *program) {
int len;
*filename = '\0';
-#ifdef _UNICODE /* currently for wince */
+# ifdef _UNICODE /* currently for wince */
if (GetModuleFileNameW(NULL, wfilename, MAX_PATH)) {
wcstombs(filename, wfilename, MAX_PATH);
-#else
+# else
if (GetModuleFileName(NULL, filename, MAX_PATH)) {
-#endif
+# endif
end = strrchr(filename, L'\\'); /* eliminate the file name which is on the right side */
if(end)
*end = '\0';
@@ -415,12 +415,21 @@ void main_init(const char *program) {
}
if (!getenv("HOME"))
setenv("HOME", getenv("NAVIT_PREFIX"), 0);
-#ifdef HAVE_API_WIN32_BASE && !HAVE_API_WIN32_CE
+# if defined(HAVE_API_WIN32) && !defined(HAVE_API_WIN32_CE)
main_setup_environment(4);
-#endif
-#ifdef HAVE_API_WIN32_CE && !HAVE_API_WIN32_BASE
+# else /* not (defined(HAVE_API_WIN32) && !defined(HAVE_API_WIN32_CE)) */
+# if defined(HAVE_API_WIN32_CE) && !defined(HAVE_API_WIN32)
main_setup_environment(2);
-#endif
+# else /* not (defined(HAVE_API_WIN32_CE) && !defined(HAVE_API_WIN32)) */
+# if defined(HAVE_API_WIN32_CE)
+# warning HAVE_API_WIN32_CE is defined
+# endif
+# if defined(HAVE_API_WIN32)
+# warning HAVE_API_WIN32 is defined
+# endif
+# error Exactly only one directive amongst HAVE_API_WIN32_CE or HAVE_API_WIN32 should be defined when preprocessor reach this section of code
+# endif
+# endif
#endif /* _WIN32 || _WIN32_WCE */
s = getenv("NAVIT_WID");