Commit c55d4df4 authored by Ilkka Ollakka's avatar Ilkka Ollakka

taglib: decode psz_file so taglib gets normal path/filename to write metadata

parent 8d8c4591
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <vlc_demux.h> #include <vlc_demux.h>
#include <vlc_strings.h> #include <vlc_strings.h>
#include <vlc_charset.h> #include <vlc_charset.h>
#include <vlc_url.h>
#ifdef WIN32 #ifdef WIN32
# include <io.h> # include <io.h>
...@@ -529,21 +530,34 @@ static int WriteMeta( vlc_object_t *p_this ) ...@@ -529,21 +530,34 @@ static int WriteMeta( vlc_object_t *p_this )
return VLC_EGENERIC; return VLC_EGENERIC;
} }
char *export_file = strdup(p_export->psz_file);
if( decode_URI( export_file ) == NULL )
{
free( export_file );
return VLC_EGENERIC;
}
#if defined(WIN32) || defined (UNDER_CE) #if defined(WIN32) || defined (UNDER_CE)
if(GetVersion() < 0x80000000) if(GetVersion() < 0x80000000)
{ {
wchar_t wpath[MAX_PATH + 1]; wchar_t wpath[MAX_PATH + 1];
if( !MultiByteToWideChar( CP_UTF8, 0, p_export->psz_file, -1, wpath, MAX_PATH) ) if( !MultiByteToWideChar( CP_UTF8, 0, export_file , -1, wpath, MAX_PATH) )
return VLC_EGENERIC; return VLC_EGENERIC;
wpath[MAX_PATH] = L'\0'; wpath[MAX_PATH] = L'\0';
f = FileRef( wpath ); f = FileRef( wpath );
} }
else else
{
free( export_file );
return VLC_EGENERIC; return VLC_EGENERIC;
}
#else #else
const char* local_name = ToLocale( p_export->psz_file ); const char* local_name = ToLocale( export_file );
if( !local_name ) if( !local_name )
{
free( export_file );
return VLC_EGENERIC; return VLC_EGENERIC;
}
f = FileRef( local_name ); f = FileRef( local_name );
LocaleFree( local_name ); LocaleFree( local_name );
#endif #endif
...@@ -551,11 +565,13 @@ static int WriteMeta( vlc_object_t *p_this ) ...@@ -551,11 +565,13 @@ static int WriteMeta( vlc_object_t *p_this )
if( f.isNull() || !f.tag() || f.file()->readOnly() ) if( f.isNull() || !f.tag() || f.file()->readOnly() )
{ {
msg_Err( p_this, "File %s can't be opened for tag writing", msg_Err( p_this, "File %s can't be opened for tag writing",
p_export->psz_file ); export_file );
free( export_file );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
msg_Dbg( p_this, "Writing metadata for %s", p_export->psz_file ); msg_Dbg( p_this, "Writing metadata for %s", export_file );
free( export_file );
Tag *p_tag = f.tag(); Tag *p_tag = f.tag();
......
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