[vlc-devel] [PATCH] subtitles: don't force double directory separators

Steve Lhomme robux4 at videolabs.io
Sat Jan 30 09:26:32 CET 2016


From: Steve Lhomme <robUx4 at gmail.com>

WindowsPhone doesn't like double backslashes in the path
---
 src/input/subtitles.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/input/subtitles.c b/src/input/subtitles.c
index 23bf4f9..9ade5d7 100644
--- a/src/input/subtitles.c
+++ b/src/input/subtitles.c
@@ -360,8 +360,16 @@ char **subtitles_Detect( input_thread_t *p_this, char *psz_path,
                 struct stat st;
                 char *path;
 
-                if( asprintf( &path, "%s"DIR_SEP"%s", psz_dir, psz_name ) < 0 )
-                    continue;
+                if( psz_dir[0] == '\0' ) {
+                    if( asprintf( &path, "%s", psz_name ) < 0 )
+                        continue;
+                } else if( psz_dir[strlen( psz_dir ) - 1] == DIR_SEP_CHAR ) {
+                    if( asprintf( &path, "%s%s", psz_dir, psz_name ) < 0 )
+                        continue;
+                } else {
+                    if( asprintf( &path, "%s"DIR_SEP"%s", psz_dir, psz_name ) < 0 )
+                        continue;
+                }
 
                 if( strcmp( path, psz_fname )
                  && vlc_stat( path, &st ) == 0
-- 
2.6.0.windows.1



More information about the vlc-devel mailing list