[Mplayer-cvslog] CVS: main mplayer.c,1.670,1.671 playtreeparser.c,1.18,1.19

Arpi of Ize arpi at mplayerhq.hu
Thu Feb 6 21:57:45 CET 2003


Update of /cvsroot/mplayer/main
In directory mail:/var/tmp.root/cvs-serv16053

Modified Files:
	mplayer.c playtreeparser.c 
Log Message:
this patch fixes latest bug, discovered by .so ... (relative filenames &
playlists) This affects also the gui (filenames with space)
patch by Fabian Franz <FabianFranz at gmx.de>


Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.670
retrieving revision 1.671
diff -u -r1.670 -r1.671
--- mplayer.c	5 Feb 2003 23:02:35 -0000	1.670
+++ mplayer.c	6 Feb 2003 20:57:25 -0000	1.671
@@ -582,6 +582,8 @@
 
 int playtree_add_playlist(play_tree_t* entry)
 {
+  play_tree_add_bpf(entry,filename);
+
 #ifdef HAVE_NEW_GUI
   if (use_gui) {
     if (entry) {
@@ -759,9 +761,22 @@
       use_gui=0;
     }
     if (use_gui && playtree_iter){
+      char* cwd;
       // Remove Playtree and Playtree-Iter from memory as its not used by gui
       play_tree_iter_free(playtree_iter);
       playtree_iter=NULL;
+      
+      if ((cwd=get_current_dir_name()))
+      {
+	cwd=(char*)realloc(cwd, strlen(cwd)+2);
+	if (cwd)
+        {
+	  strcat(cwd, "/");
+          // Prefix relative paths with current working directory
+          play_tree_add_bpf(playtree, cwd);
+	  free(cwd);
+	}
+      }      
       // Import initital playtree into gui
       import_initial_playtree_into_gui(playtree, mconfig, enqueue);
     }

Index: playtreeparser.c
===================================================================
RCS file: /cvsroot/mplayer/main/playtreeparser.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- playtreeparser.c	25 Jan 2003 11:34:00 -0000	1.18
+++ playtreeparser.c	6 Feb 2003 20:57:25 -0000	1.19
@@ -493,6 +493,26 @@
   }
 }
 
+// Wrapper for play_tree_add_basepath (add base path from file)
+void play_tree_add_bpf(play_tree_t* pt, char* filename)
+{
+  char *ls, *file;
+  
+  if (pt && filename)
+  {
+    file = strdup(filename);
+    if (file)
+    {
+      ls = strrchr(file,PATH_SEP);
+      if(ls) {
+        ls[1] = '\0';
+        play_tree_add_basepath(pt,file);
+      }
+      free(file);
+    }
+  }
+}
+
 play_tree_t*
 parse_playlist_file(char* file) {
   stream_t *stream;
@@ -517,13 +537,7 @@
     mp_msg(MSGT_PLAYTREE,MSGL_ERR,"Warning error while closing playlist file %s : %s\n",file,strerror(errno));
   free_stream(stream);
 
-  if(ret) {
-    char* ls = strrchr(file,PATH_SEP);
-    if(ls) {
-      ls[1] = '\0';
-      play_tree_add_basepath(ret,file);
-    }
-  }
+  play_tree_add_bpf(ret, file);
 
   return ret;
 



More information about the MPlayer-cvslog mailing list