Make m3u parser recognize windows path separators, as well as windows drive letters. This fixes both bug #104 and #105.

This commit is contained in:
Ron Pedde 2006-05-09 05:48:29 +00:00
parent e16844dbee
commit bcdc603b40
4 changed files with 15 additions and 3 deletions

View File

@ -404,7 +404,7 @@ int scan_static_playlist(char *path) {
return FALSE;
}
if((current=strrchr(path,'/')) == NULL) {
if((current=strrchr(path,PATHSEP)) == NULL) {
current = path;
} else {
current++;
@ -442,7 +442,7 @@ int scan_static_playlist(char *path) {
}
/* now get the *real* base_path */
strcpy(base_path,path);
if((current=strrchr(base_path,'/'))) {
if((current=strrchr(base_path,PATHSEP))) {
*(current+1) = '\x0';
} /* else something is fubar */
@ -460,7 +460,7 @@ int scan_static_playlist(char *path) {
// FIXME - should chomp trailing comments
// otherwise, assume it is a path
if(linebuffer[0] == '/') {
if((linebuffer[0] == PATHSEP) || (linebuffer[1] == ':')) {
strcpy(file_path,linebuffer);
} else {
snprintf(file_path,sizeof(file_path),"%s%s",base_path,linebuffer);

View File

@ -561,6 +561,11 @@ int os_readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result) {
entry->d_namlen - entry->d_namlen % 4;
strcpy (entry->d_name, dirp->dir_find_data.cFileName);
entry->d_type = 0;
if(dirp->dir_find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
entry->d_type |= DT_DIR;
}
/*
if (dir_is_fat)
_strlwr (dir_static.d_name);

View File

@ -20,11 +20,17 @@ struct timezone {
int tz_dsttime;
};
#define DT_DIR 1
#define W_OK 2
#define R_OK 4
struct dirent { /* data from readdir() */
long d_ino; /* inode number of entry */
unsigned short d_reclen; /* length of this record */
unsigned short d_namlen; /* length of string in d_name */
int d_type; /* flags */
char d_name[MAXNAMLEN+1]; /* name of file */
};

View File

@ -34,6 +34,7 @@
#define popen _popen
#define pclose _pclose
#define strtoll strtol
#define access _access
#define realpath os_realpath
#define close os_close