Commit 2fab80da authored by Gildas Bazin's avatar Gildas Bazin

* src/misc/win32_specific.c, modules.c: WinCE improvements (support for...

* src/misc/win32_specific.c, modules.c: WinCE improvements (support for finding out the application path + support for the plugins cache).
parent 997ef251
......@@ -690,14 +690,14 @@ void __module_Unneed( vlc_object_t * p_this, module_t * p_module )
static void AllocateAllPlugins( vlc_object_t *p_this )
{
/* Yes, there are two NULLs because we replace one with "plugin-path". */
#ifdef WIN32
char * path[] = { "modules", "", "plugins", 0, 0 };
#if defined( WIN32 ) || defined( UNDER_CE )
char *path[] = { "modules", "", "plugins", 0, 0 };
#else
char * path[] = { "modules", PLUGIN_PATH, "plugins", 0, 0 };
char *path[] = { "modules", PLUGIN_PATH, "plugins", 0, 0 };
#endif
char ** ppsz_path = path;
char * psz_fullpath;
char **ppsz_path = path;
char *psz_fullpath;
/* If the user provided a plugin path, we add it to the list */
path[ sizeof(path)/sizeof(char*) - 2 ] =
......@@ -841,9 +841,27 @@ static void AllocatePluginDir( vlc_object_t *p_this, const char *psz_dir,
- strlen( LIBEXT ),
LIBEXT, strlen( LIBEXT ) ) )
{
WIN32_FILE_ATTRIBUTE_DATA attrbuf;
int64_t i_time = 0, i_size = 0;
#ifdef UNDER_CE
if( GetFileAttributesEx( psz_wpath, GetFileExInfoStandard,
&attrbuf ) )
#else
if( GetFileAttributesEx( psz_path, GetFileExInfoStandard,
&attrbuf ) )
#endif
{
i_time = attrbuf.ftLastWriteTime.dwHighDateTime;
i_time <<= 32;
i_time |= attrbuf.ftLastWriteTime.dwLowDateTime;
i_size = attrbuf.nFileSizeHigh;
i_size <<= 32;
i_size |= attrbuf.nFileSizeLow;
}
psz_file = psz_path;
AllocatePluginFile( p_this, psz_file, 0, 0 );
AllocatePluginFile( p_this, psz_file, i_time, i_size );
}
}
while( !p_this->p_vlc->b_die && FindNextFile( handle, &finddata ) );
......@@ -1554,12 +1572,14 @@ static void CacheLoad( vlc_object_t *p_this )
if( p_this->p_libvlc->p_module_bank->b_cache_delete )
{
msg_Dbg( p_this, "removing plugins cache file %s", psz_filename );
#if !defined( UNDER_CE )
unlink( psz_filename );
#else
msg_Err( p_this, "FIXME, unlink not implemented" );
wchar_t psz_wf[MAX_PATH];
MultiByteToWideChar( CP_ACP, 0, psz_filename, -1, psz_wf, MAX_PATH );
DeleteFile( psz_wf );
#endif
msg_Dbg( p_this, "removing plugins cache file %s", psz_filename );
return;
}
......
......@@ -47,33 +47,28 @@ void system_Init( vlc_t *p_this, int *pi_argc, char *ppsz_argv[] )
WSADATA Data;
/* Get our full path */
if( ppsz_argv[0] )
{
char psz_path[MAX_PATH];
char *psz_vlc;
#if defined( UNDER_CE )
strcpy( psz_path, ppsz_argv[0] );
psz_vlc = strrchr( psz_path, '\\' );
if( psz_vlc ) psz_vlc++;
#else
GetFullPathName( ppsz_argv[0], MAX_PATH, psz_path, &psz_vlc );
#endif
if( psz_vlc > psz_path && psz_vlc[-1] == '\\' )
{
psz_vlc[-1] = '\0';
p_this->p_libvlc->psz_vlcpath = strdup( psz_path );
}
else
wchar_t psz_wpath[MAX_PATH];
if( GetModuleFileName( NULL, psz_wpath, MAX_PATH ) )
{
p_this->p_libvlc->psz_vlcpath = strdup( "" );
WideCharToMultiByte( CP_ACP, 0, psz_wpath, -1,
psz_path, MAX_PATH, NULL, NULL );
}
}
else
else psz_path[0] = '\0';
#else
if( !GetModuleFileName( NULL, psz_path, MAX_PATH ) )
{
p_this->p_libvlc->psz_vlcpath = strdup( "" );
psz_path[0] = '\0';
}
#endif
if( (psz_vlc = strrchr( psz_path, '\\' )) ) *psz_vlc = '\0';
p_this->p_libvlc->psz_vlcpath = strdup( psz_path );
/* Set the default file-translation mode */
#if !defined( UNDER_CE )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment