mirror of
https://github.com/owntone/owntone-server.git
synced 2025-04-15 00:35:55 -04:00
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:
parent
e16844dbee
commit
bcdc603b40
@ -404,7 +404,7 @@ int scan_static_playlist(char *path) {
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((current=strrchr(path,'/')) == NULL) {
|
if((current=strrchr(path,PATHSEP)) == NULL) {
|
||||||
current = path;
|
current = path;
|
||||||
} else {
|
} else {
|
||||||
current++;
|
current++;
|
||||||
@ -442,7 +442,7 @@ int scan_static_playlist(char *path) {
|
|||||||
}
|
}
|
||||||
/* now get the *real* base_path */
|
/* now get the *real* base_path */
|
||||||
strcpy(base_path,path);
|
strcpy(base_path,path);
|
||||||
if((current=strrchr(base_path,'/'))) {
|
if((current=strrchr(base_path,PATHSEP))) {
|
||||||
*(current+1) = '\x0';
|
*(current+1) = '\x0';
|
||||||
} /* else something is fubar */
|
} /* else something is fubar */
|
||||||
|
|
||||||
@ -460,7 +460,7 @@ int scan_static_playlist(char *path) {
|
|||||||
// FIXME - should chomp trailing comments
|
// FIXME - should chomp trailing comments
|
||||||
|
|
||||||
// otherwise, assume it is a path
|
// otherwise, assume it is a path
|
||||||
if(linebuffer[0] == '/') {
|
if((linebuffer[0] == PATHSEP) || (linebuffer[1] == ':')) {
|
||||||
strcpy(file_path,linebuffer);
|
strcpy(file_path,linebuffer);
|
||||||
} else {
|
} else {
|
||||||
snprintf(file_path,sizeof(file_path),"%s%s",base_path,linebuffer);
|
snprintf(file_path,sizeof(file_path),"%s%s",base_path,linebuffer);
|
||||||
|
@ -561,6 +561,11 @@ int os_readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result) {
|
|||||||
entry->d_namlen - entry->d_namlen % 4;
|
entry->d_namlen - entry->d_namlen % 4;
|
||||||
strcpy (entry->d_name, dirp->dir_find_data.cFileName);
|
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)
|
if (dir_is_fat)
|
||||||
_strlwr (dir_static.d_name);
|
_strlwr (dir_static.d_name);
|
||||||
|
@ -20,11 +20,17 @@ struct timezone {
|
|||||||
int tz_dsttime;
|
int tz_dsttime;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define DT_DIR 1
|
||||||
|
|
||||||
|
#define W_OK 2
|
||||||
|
#define R_OK 4
|
||||||
|
|
||||||
struct dirent { /* data from readdir() */
|
struct dirent { /* data from readdir() */
|
||||||
|
|
||||||
long d_ino; /* inode number of entry */
|
long d_ino; /* inode number of entry */
|
||||||
unsigned short d_reclen; /* length of this record */
|
unsigned short d_reclen; /* length of this record */
|
||||||
unsigned short d_namlen; /* length of string in d_name */
|
unsigned short d_namlen; /* length of string in d_name */
|
||||||
|
int d_type; /* flags */
|
||||||
char d_name[MAXNAMLEN+1]; /* name of file */
|
char d_name[MAXNAMLEN+1]; /* name of file */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#define popen _popen
|
#define popen _popen
|
||||||
#define pclose _pclose
|
#define pclose _pclose
|
||||||
#define strtoll strtol
|
#define strtoll strtol
|
||||||
|
#define access _access
|
||||||
|
|
||||||
#define realpath os_realpath
|
#define realpath os_realpath
|
||||||
#define close os_close
|
#define close os_close
|
||||||
|
Loading…
x
Reference in New Issue
Block a user