]> git.sesse.net Git - vlc/commitdiff
* ./src/misc/win32_specific.c: under Win32 we retrieve the executable's
authorSam Hocevar <sam@videolan.org>
Mon, 17 Feb 2003 05:50:31 +0000 (05:50 +0000)
committerSam Hocevar <sam@videolan.org>
Mon, 17 Feb 2003 05:50:31 +0000 (05:50 +0000)
    directory whenever possible, to use it for the spudec font or to load
    plugins.

include/main.h
modules/codec/spudec/spudec.c
src/misc/modules.c
src/misc/win32_specific.c

index 23ab8cc3d79b0d19a841e9efc09fb5e6ae930dbe..0521a6776ccaf067f565c1123fb532a78a28b66b 100644 (file)
@@ -3,7 +3,7 @@
  * Declaration and extern access to global program object.
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001, 2002 VideoLAN
- * $Id: main.h,v 1.52 2003/01/19 03:16:24 sam Exp $
+ * $Id: main.h,v 1.53 2003/02/17 05:50:31 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *
@@ -64,6 +64,7 @@ struct libvlc_t
     SIGNALOBJECTANDWAIT    SignalObjectAndWait;
     vlc_bool_t             b_fast_mutex;
     int                    i_win9x_cv;
+    char *                 psz_vlcpath;
 #endif
 };
 
index 404717aca5409c80a54bdd2614029d7a61dba750..7ad06901cacbc5fdc8acecb29aba4a2ae25f7fb0 100644 (file)
@@ -2,7 +2,7 @@
  * spudec.c : SPU decoder thread
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: spudec.c,v 1.14 2003/01/30 16:36:04 gbazin Exp $
+ * $Id: spudec.c,v 1.15 2003/02/17 05:50:31 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -54,11 +54,12 @@ static vout_thread_t *FindVout( spudec_thread_t * );
 
 vlc_module_begin();
     add_category_hint( N_("subtitles"), NULL );
-#if defined(SYS_DARWIN) || defined(SYS_BEOS)
+#if defined(SYS_DARWIN) || defined(SYS_BEOS) \
+     || (defined(WIN32) && !defined(UNDER_CE))
     add_file( "spudec-font", NULL, NULL,
               FONT_TEXT, FONT_LONGTEXT );
 #else
-    add_file( "spudec-font", "./share/" DEFAULT_FONT, NULL,
+    add_file( "spudec-font", "share/" DEFAULT_FONT, NULL,
               FONT_TEXT, FONT_LONGTEXT );
 #endif
     set_description( _("subtitles decoder module") );
@@ -135,6 +136,14 @@ static int RunDecoder( decoder_fifo_t * p_fifo )
                                 + strlen(DEFAULT_FONT) + 1 );
             sprintf(psz_font, "%s/share/" DEFAULT_FONT, psz_vlcpath);
         }
+#elif defined(WIN32) && !defined(UNDER_CE)
+        if ( (psz_font = config_GetPsz( p_fifo, "spudec-font" )) == NULL )
+        {
+            char * psz_vlcpath = p_fifo->p_libvlc->psz_vlcpath;
+            psz_font = malloc( strlen(psz_vlcpath) + strlen("\\share\\")
+                                + strlen(DEFAULT_FONT) + 1 );
+            sprintf(psz_font, "%s\\share\\" DEFAULT_FONT, psz_vlcpath);
+        }
 #else
         if( (psz_font = config_GetPsz( p_fifo, "spudec-font" )) == NULL )
         {
index ae35d14b7b9d650b679c6071a7b8c9276649e2ae..d7a55668119a2909c90df7b3797f09bd5a65ac2d 100644 (file)
@@ -2,7 +2,7 @@
  * modules.c : Builtin and plugin modules management functions
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: modules.c,v 1.111 2003/01/27 17:41:01 ipkiss Exp $
+ * $Id: modules.c,v 1.112 2003/02/17 05:50:31 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Ethan C. Baldridge <BaldridgeE@cadmus.com>
@@ -551,7 +551,8 @@ static void AllocateAllPlugins( vlc_object_t *p_this )
 
     char **         ppsz_path = path;
     char *          psz_fullpath;
-#if defined( SYS_BEOS ) || defined( SYS_DARWIN )
+#if defined( SYS_BEOS ) || defined( SYS_DARWIN ) \
+     || ( defined( WIN32 ) && !defined( UNDER_CE ) )
     int             i_vlclen = strlen( p_this->p_libvlc->psz_vlcpath );
     vlc_bool_t      b_notinroot;
 #endif
@@ -566,14 +567,19 @@ static void AllocateAllPlugins( vlc_object_t *p_this )
 
     for( ; *ppsz_path != NULL ; ppsz_path++ )
     {
-#if defined( SYS_BEOS ) || defined( SYS_DARWIN )
+#if defined( SYS_BEOS ) || defined( SYS_DARWIN ) \
+     || ( defined( WIN32 ) && !defined( UNDER_CE ) )
         /* Store strlen(*ppsz_path) for later use. */
         int i_dirlen = strlen( *ppsz_path );
 
         b_notinroot = VLC_FALSE;
         /* Under BeOS, we need to add beos_GetProgramPath() to access
          * files under the current directory */
-        if( ( i_dirlen > 1 ) && strncmp( *ppsz_path, "/", 1 ) )
+#ifdef WIN32
+        if( i_dirlen < 3 || ppsz_path[3] != '\\' )
+#else
+        if( ppsz_path[0] != '/' )
+#endif
         {
             i_dirlen += i_vlclen + 2;
             b_notinroot = VLC_TRUE;
index 2808959679a4be3aa811d93987ee0eebfdf966df..8af5d9fd26f6971e0dee4e76cab283a7c2a2c300 100644 (file)
@@ -2,7 +2,7 @@
  * win32_specific.c: Win32 specific features
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: win32_specific.c,v 1.20 2003/01/19 03:16:24 sam Exp $
+ * $Id: win32_specific.c,v 1.21 2003/02/17 05:50:31 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Gildas Bazin <gbazin@netcourrier.com>
@@ -40,6 +40,29 @@ void system_Init( vlc_t *p_this, int *pi_argc, char *ppsz_argv[] )
     WSADATA Data;
     int i_err;
 
+    /* Get our full path */
+    if( ppsz_argv[0] )
+    {
+        char psz_path[MAX_PATH];
+        char *psz_vlc;
+
+        GetFullPathName( ppsz_argv[0], MAX_PATH, psz_path, &psz_vlc );
+
+        if( psz_vlc > psz_path && psz_vlc[-1] == '\\' )
+        {
+            psz_vlc[-1] = '\0';
+            p_this->p_libvlc->psz_vlcpath = strdup( psz_path );
+        }
+        else
+        {
+            p_this->p_libvlc->psz_vlcpath = strdup( "" );
+        }
+    }
+    else
+    {
+        p_this->p_libvlc->psz_vlcpath = strdup( "" );
+    }
+
     /* WinSock Library Init. */
     i_err = WSAStartup( MAKEWORD( 1, 1 ), &Data );