MinGW
[oweals/gnunet.git] / src / util / os_installation.c
index 20109554457c047a8719169533c975d5e229c8c4..7079e2fef204c9bec2c455226a9d737c209fa91b 100644 (file)
@@ -42,7 +42,7 @@ extern "C"
 #include "gnunet_configuration_lib.h"
 #include "gnunet_disk_lib.h"
 #include "gnunet_os_lib.h"
-#if OSX
+#if DARWIN
 #include <mach-o/ldsyms.h>
 #include <mach-o/dyld.h>
 #endif
@@ -137,7 +137,7 @@ get_path_from_module_filename ()
 }
 #endif
 
-#if OSX
+#if DARWIN
 typedef int (*MyNSGetExecutablePathProto) (char *buf, size_t * bufsize);
 
 static char *
@@ -213,14 +213,12 @@ get_path_from_PATH ()
   char *end;
   char *buf;
   const char *p;
-  size_t size;
 
   p = getenv ("PATH");
   if (p == NULL)
     return NULL;
   path = GNUNET_strdup (p);     /* because we write on it */
   buf = GNUNET_malloc (strlen (path) + 20);
-  size = strlen (path);
   pos = path;
 
   while (NULL != (end = strchr (pos, ':')))
@@ -287,7 +285,7 @@ os_get_gnunet_path ()
   if (ret != NULL)
     return ret;
 #endif
-#if OSX
+#if DARWIN
   ret = get_path_from_dyld_image ();
   if (ret != NULL)
     return ret;
@@ -299,6 +297,10 @@ os_get_gnunet_path ()
   if (ret != NULL)
     return ret;
   /* other attempts here */
+  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+              _
+              ("Could not determine installation path for GNUnet.  Set `%s' environment variable.\n"),
+              "GNUNET_PREFIX");
   return NULL;
 }
 
@@ -313,6 +315,7 @@ os_get_exec_path ()
 {
   char *ret;
 
+  ret = NULL;
 #if LINUX
   ret = get_path_from_proc_exe ();
   if (ret != NULL)
@@ -323,13 +326,13 @@ os_get_exec_path ()
   if (ret != NULL)
     return ret;
 #endif
-#if OSX
+#if DARWIN
   ret = get_path_from_NSGetExecutablePath ();
   if (ret != NULL)
     return ret;
 #endif
   /* other attempts here */
-  return NULL;
+  return ret;
 }
 
 
@@ -440,4 +443,4 @@ GNUNET_OS_installation_get_path (enum GNUNET_OS_InstallationPathKind dirkind)
 #ifdef __cplusplus
 }
 #endif
-/* end of installpath.c */
+/* end of os_installation.c */