[Mplayer-cvslog] CVS: main mplayer.c, 1.767, 1.768 playtreeparser.c, 1.29, 1.30

Joey Parrish CVS syncmail at mplayerhq.hu
Fri Aug 13 00:33:24 CEST 2004


CVS change done by Joey Parrish CVS

Update of /cvsroot/mplayer/main
In directory mail:/var2/tmp/cvs-serv27781

Modified Files:
	mplayer.c playtreeparser.c 
Log Message:
windows path seperator fixes
mp_basename now looks for \ and / both
new playlist parsing:
  /path/to/thing is treated as a full path
  c:\windows is treated as a full path
  \windows is "near-full" and we prepend drive letter
  file.avi is relative and we prepend path to playlist


Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.767
retrieving revision 1.768
diff -u -r1.767 -r1.768
--- mplayer.c	9 Aug 2004 18:06:08 -0000	1.767
+++ mplayer.c	12 Aug 2004 22:33:21 -0000	1.768
@@ -619,7 +619,8 @@
   return eof;
 }
 
-#define mp_basename(s) (strrchr(s,'/')==NULL?(char*)s:(strrchr(s,'/')+1))
+#define mp_basename2(s) (strrchr(s,'/')==NULL?(char*)s:(strrchr(s,'/')+1))
+#define mp_basename(s) (strrchr(s,'\\')==NULL?(mp_basename2(s)):(strrchr(s,'\\')+1))
 
 int playtree_add_playlist(play_tree_t* entry)
 {

Index: playtreeparser.c
===================================================================
RCS file: /cvsroot/mplayer/main/playtreeparser.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- playtreeparser.c	26 Jun 2004 13:07:04 -0000	1.29
+++ playtreeparser.c	12 Aug 2004 22:33:21 -0000	1.30
@@ -20,12 +20,6 @@
 #include "mp_msg.h"
 
 
-#if defined(__CYGWIN__) || defined(__OS2__)
-#define PATH_SEP '\\'
-#else
-#define PATH_SEP '/'
-#endif
-
 extern play_tree_t*
 asx_parser_build_tree(char* buffer, int ref);
 
@@ -630,8 +624,16 @@
 
   for(i = 0 ; pt->files[i] != NULL ; i++) {
     fl = strlen(pt->files[i]);
-    if(fl <= 0 || pt->files[i][0] == PATH_SEP || strstr(pt->files[i],"://"))
+    // if we find url:// or X:\ at the beginning, don't mangle it.
+    if(fl <= 0 || strstr(pt->files[i],"://") || strstr(pt->files[i],":\\") == pt->files[i] + 1)
       continue;
+    // if the path begins with \ then prepend drive letter to it.
+    if (pt->files[i][0] == '\\') {
+      pt->files[i] = (char*)realloc(pt->files[i],2+fl+1);
+      memmove(pt->files[i] + 2,pt->files[i],fl+1);
+      memcpy(pt->files[i],bp,2);
+      return;
+    }
     pt->files[i] = (char*)realloc(pt->files[i],bl+fl+1);
     memmove(pt->files[i] + bl,pt->files[i],fl+1);
     memcpy(pt->files[i],bp,bl);
@@ -648,7 +650,8 @@
     file = strdup(filename);
     if (file)
     {
-      ls = strrchr(file,PATH_SEP);
+      ls = strrchr(file,'/');
+      if(!ls) ls = strrchr(file,'\\');
       if(ls) {
         ls[1] = '\0';
         play_tree_add_basepath(pt,file);




More information about the MPlayer-cvslog mailing list