Commit 370b6cbb authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Use file path instead of URL where appropriate

parent c20f0e81
...@@ -139,7 +139,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -139,7 +139,7 @@ static int Open( vlc_object_t *p_this )
vcddev_t *vcddev; vcddev_t *vcddev;
char *psz_name; char *psz_name;
if( !p_access->psz_path || !*p_access->psz_path ) if( !p_access->psz_filepath || !*p_access->psz_filepath )
{ {
/* Only when selected */ /* Only when selected */
if( !p_access->psz_access || !*p_access->psz_access ) if( !p_access->psz_access || !*p_access->psz_access )
...@@ -152,7 +152,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -152,7 +152,7 @@ static int Open( vlc_object_t *p_this )
return VLC_EGENERIC; return VLC_EGENERIC;
} }
} }
else psz_name = ToLocaleDup( p_access->psz_path ); else psz_name = ToLocaleDup( p_access->psz_filepath );
#ifdef WIN32 #ifdef WIN32
if( psz_name[0] && psz_name[1] == ':' && if( psz_name[0] && psz_name[1] == ':' &&
......
...@@ -99,10 +99,10 @@ int DirOpen( vlc_object_t *p_this ) ...@@ -99,10 +99,10 @@ int DirOpen( vlc_object_t *p_this )
{ {
access_t *p_access = (access_t*)p_this; access_t *p_access = (access_t*)p_this;
if( !p_access->psz_path ) if( !p_access->psz_filepath )
return VLC_EGENERIC; return VLC_EGENERIC;
DIR *handle = vlc_opendir (p_access->psz_path); DIR *handle = vlc_opendir (p_access->psz_filepath);
if (handle == NULL) if (handle == NULL)
return VLC_EGENERIC; return VLC_EGENERIC;
...@@ -122,7 +122,7 @@ int DirInit (access_t *p_access, DIR *handle) ...@@ -122,7 +122,7 @@ int DirInit (access_t *p_access, DIR *handle)
uri = NULL; uri = NULL;
} }
else else
uri = make_URI (p_access->psz_path); uri = make_URI (p_access->psz_filepath);
if (unlikely(uri == NULL)) if (unlikely(uri == NULL))
goto error; goto error;
...@@ -238,7 +238,7 @@ block_t *DirBlock (access_t *p_access) ...@@ -238,7 +238,7 @@ block_t *DirBlock (access_t *p_access)
current->parent = NULL; current->parent = NULL;
current->handle = p_sys->handle; current->handle = p_sys->handle;
#ifndef HAVE_OPENAT #ifndef HAVE_OPENAT
current->path = strdup (p_access->psz_path); current->path = strdup (p_access->psz_filepath);
#endif #endif
current->uri = p_sys->uri; current->uri = p_sys->uri;
if (fstat (dirfd (current->handle), &current->st)) if (fstat (dirfd (current->handle), &current->st))
......
...@@ -133,7 +133,7 @@ static bool IsRemote (int fd) ...@@ -133,7 +133,7 @@ static bool IsRemote (int fd)
int Open( vlc_object_t *p_this ) int Open( vlc_object_t *p_this )
{ {
access_t *p_access = (access_t*)p_this; access_t *p_access = (access_t*)p_this;
const char *path = p_access->psz_path; const char *path = p_access->psz_filepath;
#ifdef WIN32 #ifdef WIN32
bool is_remote = false; bool is_remote = false;
#endif #endif
......
...@@ -83,7 +83,7 @@ static int Open (vlc_object_t *p_this) ...@@ -83,7 +83,7 @@ static int Open (vlc_object_t *p_this)
{ {
access_t *p_access = (access_t *)p_this; access_t *p_access = (access_t *)p_this;
access_sys_t *p_sys; access_sys_t *p_sys;
const char *path = p_access->psz_path; const char *path = p_access->psz_filepath;
int fd; int fd;
assert ((INT64_C(1) << 63) == ((off_t)(INT64_C(1) << 63))); assert ((INT64_C(1) << 63) == ((off_t)(INT64_C(1) << 63)));
......
...@@ -126,8 +126,10 @@ static int Open( vlc_object_t *p_this ) ...@@ -126,8 +126,10 @@ static int Open( vlc_object_t *p_this )
if( ( p_device = LIBMTP_Open_Raw_Device( &p_rawdevices[i] ) if( ( p_device = LIBMTP_Open_Raw_Device( &p_rawdevices[i] )
) != NULL ) ) != NULL )
{ {
free( p_access->psz_path ); free( p_access->psz_filepath );
if( ( p_access->psz_path = tempnam( NULL, "vlc" ) ) == NULL ) #warning Oooh no! Not tempnam()!
p_access->psz_filepath = tempnam( NULL, "vlc" );
if( p_access->psz_filepath == NULL )
{ {
LIBMTP_Release_Device( p_device ); LIBMTP_Release_Device( p_device );
free( p_rawdevices ); free( p_rawdevices );
...@@ -135,9 +137,11 @@ static int Open( vlc_object_t *p_this ) ...@@ -135,9 +137,11 @@ static int Open( vlc_object_t *p_this )
} }
else else
{ {
msg_Dbg( p_access, "About to write %s", p_access->psz_path ); msg_Dbg( p_access, "About to write %s",
p_access->psz_filepath );
LIBMTP_Get_File_To_File( p_device, i_track_id, LIBMTP_Get_File_To_File( p_device, i_track_id,
p_access->psz_path, NULL, NULL ); p_access->psz_filepath, NULL,
NULL );
LIBMTP_Release_Device( p_device ); LIBMTP_Release_Device( p_device );
i = i_numrawdevices; i = i_numrawdevices;
} }
...@@ -156,8 +160,8 @@ static int Open( vlc_object_t *p_this ) ...@@ -156,8 +160,8 @@ static int Open( vlc_object_t *p_this )
int fd = p_sys->fd = -1; int fd = p_sys->fd = -1;
/* Open file */ /* Open file */
msg_Dbg( p_access, "opening file `%s'", p_access->psz_path ); msg_Dbg( p_access, "opening file `%s'", p_access->psz_filepath );
fd = open_file( p_access, p_access->psz_path ); fd = open_file( p_access, p_access->psz_filepath );
if( fd == -1 ) if( fd == -1 )
{ {
...@@ -187,8 +191,9 @@ static void Close( vlc_object_t * p_this ) ...@@ -187,8 +191,9 @@ static void Close( vlc_object_t * p_this )
access_sys_t *p_sys = p_access->p_sys; access_sys_t *p_sys = p_access->p_sys;
close ( p_sys->fd ); close ( p_sys->fd );
if( vlc_unlink( p_access->psz_path ) != 0 ) if( vlc_unlink( p_access->psz_filepath ) != 0 )
msg_Err( p_access, "Error deleting file %s, %m", p_access->psz_path ); msg_Err( p_access, "Error deleting file %s, %m",
p_access->psz_filepath );
free( p_sys ); free( p_sys );
} }
......
...@@ -96,7 +96,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -96,7 +96,7 @@ static int Open( vlc_object_t *p_this )
{ {
access_t *p_access = (access_t *)p_this; access_t *p_access = (access_t *)p_this;
access_sys_t *p_sys; access_sys_t *p_sys;
char *psz_dup = ToLocaleDup( p_access->psz_path ); char *psz_dup = ToLocaleDup( p_access->psz_filepath );
char *psz; char *psz;
int i_title = 0; int i_title = 0;
int i_chapter = 0; int i_chapter = 0;
......
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