summaryrefslogtreecommitdiffstats
path: root/playtreeparser.c
diff options
context:
space:
mode:
authorjoey <joey@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-08-12 22:33:21 +0000
committerjoey <joey@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-08-12 22:33:21 +0000
commiteabfd291c415d34796637b0bdcd23a8fa377e3be (patch)
tree07eec21ad84a5ca8011bdfa9747c5ca5fffc27b1 /playtreeparser.c
parent9dc5c04bce6786935854cb60a98e524ebb7a9e11 (diff)
downloadmpv-eabfd291c415d34796637b0bdcd23a8fa377e3be.tar.bz2
mpv-eabfd291c415d34796637b0bdcd23a8fa377e3be.tar.xz
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 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@13011 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'playtreeparser.c')
-rw-r--r--playtreeparser.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/playtreeparser.c b/playtreeparser.c
index 372d8bd2fd..153d1948cf 100644
--- a/playtreeparser.c
+++ b/playtreeparser.c
@@ -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 @@ play_tree_add_basepath(play_tree_t* pt, char* bp) {
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 @@ void play_tree_add_bpf(play_tree_t* pt, char* filename)
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);