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

Steve Lhomme robux4 at gmail.com
Tue Aug 25 10:20:23 CEST 2015


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 60e59c2..d84339c 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.5.0



More information about the vlc-devel mailing list