]> git.sesse.net Git - vlc/commitdiff
src/darwin_specific.c: Get a better executable path name.
authorPierre d'Herbemont <pdherbemont@videolan.org>
Thu, 7 Feb 2008 23:47:44 +0000 (23:47 +0000)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Thu, 7 Feb 2008 23:47:44 +0000 (23:47 +0000)
src/misc/darwin_specific.c

index 90cd16e0ab8cefcb46e6a5e9db56bf44bfa192bd..3340c7c278dcb6b50555d57700253bcd351a2557 100644 (file)
@@ -36,6 +36,9 @@
 #ifdef HAVE_LOCALE_H
 #   include <locale.h>
 #endif
+#ifdef HAVE_MACH_O_DYLD_H
+#   include <mach-o/dyld.h>
+#endif
 
 /* CFLocaleCopyAvailableLocaleIdentifiers is present only on post-10.4 */
 extern CFArrayRef CFLocaleCopyAvailableLocaleIdentifiers(void) __attribute__((weak_import));
@@ -101,6 +104,13 @@ void system_Init( libvlc_int_t *p_this, int *pi_argc, char *ppsz_argv[] )
         }
     }
 
+    if( !p_char )
+    {
+        char path[MAXPATHLEN+1];
+        uint32_t path_len = MAXPATHLEN;
+        if ( !_NSGetExecutablePath(path, &path_len) )
+            p_char = strdup(path);
+    }
     if( !p_char )
     {
         /* We are not linked to the VLC.framework, return the executable path */